[cmake-developers] [CMake 0014737]: $ENV{FOO} always evaluates to FALSE

Mantis Bug Tracker mantis at public.kitware.com
Wed Feb 5 10:49:08 EST 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=14737 
====================================================================== 
Reported By:                Alex Merry
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14737
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-02-05 10:49 EST
Last Modified:              2014-02-05 10:49 EST
====================================================================== 
Summary:                    $ENV{FOO} always evaluates to FALSE
Description: 
A script like
if($ENV{FOO})
  # do something
endif()
will never evaluate the statements in the if() branch, regardless of the value
of the environment variable FOO.

Steps to Reproduce: 
Store the attached testenv.cmake somewhere, then run
FOO="" cmake -P testenv.cmake
As expected, the output is
-- $ENV{FOO} = 
-- $ENV{FOO} evaluates to FALSE
-- ENV{FOO} evaluates to FALSE

Now try
FOO="bar" cmake -P testenv.cmake
The output is
-- $ENV{FOO} = bar
-- $ENV{FOO} evaluates to FALSE
-- ENV{FOO} evaluates to FALSE
when the expected output would be
-- $ENV{FOO} = bar
-- $ENV{FOO} evaluates to TRUE
-- ENV{FOO} evaluates to TRUE

Additional Information: 
Tested with cmake 2.8.12 and cmake 2.8.12.20140204-g5414b
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-02-05 10:49 Alex Merry     New Issue                                    
2014-02-05 10:49 Alex Merry     File Added: testenv.cmake                    
======================================================================



More information about the cmake-developers mailing list