The following issue has been SUBMITTED. ====================================================================== https://cmake.org/Bug/view.php?id=16017 ====================================================================== Reported By: Abai Assigned To: ====================================================================== Project: CMake Issue ID: 16017 Category: CMake Reproducibility: always Severity: major Priority: normal Status: new ====================================================================== Date Submitted: 2016-03-14 10:37 EDT Last Modified: 2016-03-14 10:37 EDT ====================================================================== Summary: Setting OPTION to ON results in FALSE Description: It seems that setting an arbitrary option to ON results in variable to be set to OFF instead. I am certain that the variable is not cached too. See the example below to reproduce.
Here is the output from the attached CMakeLists.txt: -- The C compiler identification is AppleClang 7.0.2.7000181 -- The CXX compiler identification is AppleClang 7.0.2.7000181 -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- WAX is not defined. -- Setting WAX=ON. -- Results in WAX=OFF -- Configuring done -- Generating done The only workaround I found around is (FORCE is required even with empty cache): SET(WAX ON CACHE BOOL "" FORCE) Steps to Reproduce: PROJECT(OPTION_BUG) CMAKE_MINIMUM_REQUIRED(VERSION 3.5.0 FATAL_ERROR) IF(NOT DEFINED WAX) MESSAGE(STATUS "WAX is not defined.") ENDIF() MESSAGE(STATUS "Setting WAX=ON.") OPTION(WAX ON) MESSAGE(STATUS "Results in WAX=${WAX}") Additional Information: CMake version 3.5.0 installed with home-brew on OSX 10.11.3 ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2016-03-14 10:37 Abai New Issue 2016-03-14 10:37 Abai File Added: CMakeLists.txt ====================================================================== -- 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: http://public.kitware.com/mailman/listinfo/cmake-developers