[CMake] libs only target

Mike Talbot mtalbot at abingdon.oilfield.slb.com
Fri Jun 2 10:26:23 EDT 2006


Brad King wrote:
> Jan Woetzel wrote:
>> is there a way to compile/link only the "libs" (ADD_LIBRARY)
>> but skip linking the executables (ADD_EXECUTABLE)
>> using a global option/switch on cmake level?
>>
>> I want to save compilation time when I need only the libraries for 
>> linking my client project.
>> But we have about 200 examples in subdirectories and linking them 
>> takes a lot of time...
>
> OPTION(BUILD_EXAMPLES "Build examples" OFF)
> IF(BUILD_EXAMPLES)
>   ADD_SUBDIRECTORY(Examples)
> ENDIF(BUILD_EXAMPLES)
>
> -Brad
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
Why not try

ADD_SUBDIRECTORY(Examples EXCLUDE_FROM_ALL)

The manual suggests this is a good way to have examples included in the 
build system, but not built by default.



More information about the CMake mailing list