Jan Woetzel wrote:
Brad King wrote:

IF(BUILD_EXAMPLES)


Thanks Brad,
that's almost the approach we currently use except
IF (BUILD_EXAMPLES OR BUILD_TESTING)
for ctest ADD_TEST executable targets.

However,
we are not satisfied with this approach because:
(1) If someone has built only the libs and he decides he wants the examples, he has to run cmake to set BUILD_EXAMPLES (which takes time) which creates/configures a new config.h (from config.in). This config.h is included alomost everywhere and thus everything is unneccessarily rebuilt.

Why do you have a definition for BUILD_EXAMPLES in the top-level config.h? Building the libs certainly shouldn't care whether examples will be built. If a few of the sources do need to know for some reason just create a different configured header for BUILD_EXAMPLES and include it in only the sources that need it.

So we prefer the approach of target:
- "all" build libs+executables,
- "libs" compiles+links all libraries but skips compiling+linking executables.

ADD_CUSTOM_TARGET(libs)
ADD_DEPENDENCIES(libs lib1 lib2)

-Brad
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to