View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0013376 | CMake | CMake | public | 2012-07-04 22:59 | 2012-12-03 07:46 | ||||
Reporter | Bruce Cartland | ||||||||
Assigned To | |||||||||
Priority | low | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | no change required | ||||||
Platform | Windows | OS | XP | OS Version | SP3 | ||||
Product Version | CMake 2.8.8 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0013376: For unset variables IF(${var}) and IF(NOT ${var}) both return FALSE which fails to work for predefined vars such as CYGWIN | ||||||||
Description | (I'm a noob so please excuse if this is already report, not formatted correctly, or invalid :) See steps to reproduce. | ||||||||
Steps To Reproduce | message(STATUS "CYGWIN = '${CYGWIN}'") if(${CYGWIN}) message(STATUS "CYGWIN set") else() set(CYGWIN 0) #this "fixes" the problem and results in expected behaviour message(STATUS "CYGWIN not set") endif() if(NOT ${CYGWIN}) message(STATUS "CYGWIN not set") else() message(STATUS "CYGWIN set - or is it?") endif() | ||||||||
Additional Information | The script in steps to reproduce results in the following output: -- CYGWIN = '' -- CYGWIN not set -- CYGWIN set - or is it? Seems to me that FALSE should be defined to include blank as well as NO, etc OR variables such as CYGWIN should be set to 0 and not left blank. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0029909) Bruce Cartland (reporter) 2012-07-04 23:02 |
Oops! Sorry! The line in the script steps to reproduce set(CYGWIN 0) #this "fixes" the problem and results in expected behaviour should be commented out #set(CYGWIN 0) #this "fixes" the problem and results in expected behaviour to get the output I listed. (Can't edit the original text). |
(0030002) Brad King (manager) 2012-07-09 09:37 |
When CYGWIN is not set the code if(NOT ${CYGWIN}) expands to just if(NOT) which is somewhat non-sensical but evaluates to false. Using double quotes ensures a value is treated as a single argument: if(NOT "") is true. Anyway, to test variables that may or may not be set just use the name of the variable: if(CYGWIN) message(STATUS "This is Cygwin") else() message(STATUS "This is not Cygwin") endif() Please see full behavior of if() in the reference documentation: http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:if [^] and/or join the mailing list to ask for further help: http://www.cmake.org/mailman/listinfo/cmake [^] |
(0031810) David Cole (manager) 2012-12-03 07:46 |
Closing resolved issues that have not been updated in more than 4 months. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2012-07-04 22:59 | Bruce Cartland | New Issue | |
2012-07-04 23:02 | Bruce Cartland | Note Added: 0029909 | |
2012-07-09 09:37 | Brad King | Note Added: 0030002 | |
2012-07-09 09:37 | Brad King | Status | new => resolved |
2012-07-09 09:37 | Brad King | Resolution | open => no change required |
2012-12-03 07:46 | David Cole | Note Added: 0031810 | |
2012-12-03 07:46 | David Cole | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |