For Lazarus go into Project options:
Project options -> Miscellaneous:
Uncheck "Always build (even if nothing changed)"

But as the compiler is quite fast anyway in my opinion (talking of fraction of second with larger projects) and because of not compiling everything you may encounter unwanted problems - i'm using the "Always build".