View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0016017 | CMake | CMake | public | 2016-03-14 10:37 | 2016-06-10 14:21 | ||||
Reporter | Abai | ||||||||
Assigned To | |||||||||
Priority | normal | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | no change required | ||||||
Platform | Apple Mac | OS | OSX | OS Version | 10.11.3 | ||||
Product Version | CMake 3.5 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0016017: 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 | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | CMakeLists.txt [^] (231 bytes) 2016-03-14 10:37 [Show Content] | ||||||||
Relationships | |
Relationships |
Notes | |
(0040672) Brad King (manager) 2016-03-14 10:46 |
The option() command signature is documented here: https://cmake.org/cmake/help/v3.5/command/option.html [^] The second argument is a documentation string. The third argument is the default value, if any, and the default default is OFF. Therefore the code option(WAX ON) creates an option called "WAX" whose documentation is "ON" and whose default value is "OFF". |
(0040677) Abai (reporter) 2016-03-14 10:57 |
Ah, my bad. Thank you! I guess it's a common misunderstanding as I have seen a few others making the same mistake. |
(0041230) Kitware Robot (administrator) 2016-06-10 14:21 |
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
Notes |
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 | |
2016-03-14 10:46 | Brad King | Note Added: 0040672 | |
2016-03-14 10:47 | Brad King | Status | new => resolved |
2016-03-14 10:47 | Brad King | Resolution | open => no change required |
2016-03-14 10:57 | Abai | Note Added: 0040677 | |
2016-06-10 14:21 | Kitware Robot | Note Added: 0041230 | |
2016-06-10 14:21 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |