Gaurav's answer above is incorrect. Viral licenses are called that for a reason: they are licenses that, like a virus, spread beyond the source of your project. It means that if my program has 99 features that I created myself, and 1 that requires a GPL library, the GPL "infects" my entire codebase and forces me to publish the entire thing under the GPL or a compatible license.
This is not what the question is asking for, and to put it bluntly, this is not suitable for the majority of open-source project development. The GPL is not a license so much as it is a political statement, declaring to the world that you believe non-"free" (as per the FSF definition) software to be inherently evil and something that must be fought against and eradicated.
If that's what you want, go ahead and use the GPL. But if you're looking for an open-source license that will ensure that modifications to your code must remain open and be published under the same license, (without limiting what the people who use your code in a wider project can do with it,) the license you're looking for is the Mozilla Public License, which requires exactly that.