[cmake-developers] [CMake 0013376]: For unset variables IF(${var}) and IF(NOT ${var}) both return FALSE which fails to work for predefined vars such as CYGWIN

Mantis Bug Tracker mantis at public.kitware.com
Wed Jul 4 22:59:09 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://cmake.org/Bug/view.php?id=13376 
====================================================================== 
Reported By:                Bruce Cartland
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13376
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   low
Status:                     new
====================================================================== 
Date Submitted:             2012-07-04 22:59 EDT
Last Modified:              2012-07-04 22:59 EDT
====================================================================== 
Summary:                    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.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-07-04 22:59 Bruce Cartland New Issue                                    
======================================================================




More information about the cmake-developers mailing list