[CMake] Feature request: generic (config-like) selector on target_link_libraries

Denis Scherbakov denis_scherbakov at yahoo.com
Tue Mar 24 07:56:23 EDT 2009


I think you don't need a new feature, you just have to use IF-ELSE mechanism and then TARGET_LINK_LIBRARIES(target  ${RESULT_OF_IF_ELSE})

Denis


> * lib3 CMakeLists.txt:
> 
> add_library(lib3  some source)
> target_link_libraries(lib3,
> SELECTOR  A_OR_B  A  lib4-A
> SELECTOR  A_OR_B  B  lib4-B
>       )

> * exe1-A CmakeLists.txt
>       add_executable(exe1-A  some sources)
>       set (A_OR_B  A)
>       target_link_libraries(exe1-A  lib1)
> 
> * exe1-B CmakeLists.txt
>       add_executable(exe1-A  some sources)
>       set (A_OR_B  B)
>       target_link_libraries(exe1-A  lib1)


      


More information about the CMake mailing list