[CMake] Multiple executables sharing object files

Mike Talbot mtalbot at abingdon.oilfield.slb.com
Wed Dec 19 11:48:33 EST 2007


I work on a similarly large project and have found that building shared
libraries for development is much faster (in terms of compile/link time)
when making small changes (working in Visual Studio). Nightly or test builds
can use static libraries to produce single executables.

Provided you have setup suitable declspec macros etc, it is easy to switch
between static or shared using the BUILD_SHARED_LIBS cmake option.

Mike

>
> Maybe I am missing something, but why not create a static library and
> share it with the executables?  Why try to reuse object files?  CMake
> makes it very easy to create static libraries and link them to
executables.
>
> -Bill

Because then you have to relink all executables each time you change one of
the
library files, even the ones that don't rely on that file. Which isn't
efficient
either. Say you have 100 library files, and 30 executables, which depend on
average on 20 library files. Using a intermediary static library is not
going to
help you...

Object files were probably created exactly for this, so they could be shared

between multiple targets without being rebuilt needlessly. Why exactly isn't

there an option to share the build directory between targets, like it was
the
standard behavior prior to 2005?

joel


> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake





More information about the CMake mailing list