[CMake] Way to use precompilation directive on cmake and conditionnal linking

Nadir SOUALEM nadir.soualem at irisa.fr
Tue Mar 24 10:38:01 EDT 2009


Nadir SOUALEM wrote:
> I would like to use precompilation directive such NO_OPENGL
> Is there a way to use it with this command line ?
> cmake -DCMAKE_BUILD_TYPE=Debug
>
> or must i use something like:
> cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_OPENGL=0
>
> with an if statement:
> if(NOT WITH_OPENGL)
> ADD_DEFINITIONS(-DNO_OPENGL)
> endif
>
> I would like to use a conditional linking, on our clusters there's no 
> X11, no Opengl ...
> How to make a conditional linking, for example if NO_OPENGL
>
>
> TARGET_LINK_LIBRARIES(MyExe
> A
> B
> C)
>
> else
>
> TARGET_LINK_LIBRARIES(MyExe
> A
> B
> C
> GL
> GLU
> GLUT)
>
> What is the best and properly way to do that ?
>
> Thank you for your anwsers.
>
>
>
>
>
> Thank you.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
any clue ?

Thank you

-- 
Nadir SOUALEM
Ingénieur INRIA - Équipe SAGE
INRIA-IRISA . campus de Beaulieu . F - 35 042 Rennes Cedex 
Tel: 02 99 84 71 47



More information about the CMake mailing list