Dear All,

I'm plagued by an issue that I do not understand. An if-statement
(in a package configuration file) evaluates ON to false:

IF(ON)
    ...some code here
ENDIF()

The part inside IF is *not* executed. Replacing ON by TRUE does not
help, only replacing it by 1 helps. Is this correct behaviour? I can
not understand this from the documentation. The docs seem to say "ON"
would be a valid token for true: 
https://cmake.org/cmake/help/v3.6/command/if.html

The full user story is that in the package configuration I'd like to
treat shared libraries specially, so I use "IF(@BUILD_SHARED_LIBS@)".
The user configures the build with

    cmake -DBUILD_SHARED_LIBS=ON .

so the package configuration gets resolved to "IF(ON)". I have not
too much control about the way users specify the options, so I'd
like to solve this on my end. If options should not keep the value
"ON", how can I cleanly resolve them to the corresponding number 0/1?

Am I doing something wrong?

All the best,

    Mario Emmenlauer


--
BioDataAnalysis GmbH, Mario Emmenlauer     Tel. Office: +49-89-74677203
Balanstr. 43                   mailto: memmenlauer * biodataanalysis.de
D-81669 Munich                           http://www.biodataanalysis.de/
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to