Using CMake, is there a way to generate build systems that don't relink everything downstream if a shared library's source code changes without its headers changing?
In Makefiles, I've used rules with an order only prerequisite on the shared library itself and regular prerequisites on the library headers to get this effect.
I know this isn't strictly guaranteed to produce a correct build, e.g. you could delete a function definition from the shared library, but this is for quickly rebuilding a debug build and in my experience it almost always has produced a correct build. I think there was once or twice that I ran into a runtime linker error but on that odd occasion it's not much trouble to run the build as usual.
Still, if there are good reasons that this is actually a terrible idea and shouldn't be done that could be an answer too.
In CMake 2.8.11 and later you can set CMAKE_LINK_DEPENDS_NO_SHARED
to get this behavior.
http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/43246/focus=44469
http://www.cmake.org/cmake/help/v3.1/prop_tgt/LINK_DEPENDS_NO_SHARED.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With