Hi,<br><br>I&#39;ve just had a CMakeLists.txt fail to work as expected because somebody was testing to see whether an environment variable was set with the syntax: if (DEFINED $ENV{VAR}).  This short example shows the problem:<br>
<br><div style="margin-left: 40px;">cmake_minimum_required(VERSION 2.8)<br><br>project(foo)<br><br>message(&quot;HOME: $ENV{HOME}&quot;)<br>if (DEFINED $ENV{HOME})<br>    message(&quot;HOME is defined&quot;)<br>else()<br>
    message(&quot;HOME is NOT defined&quot;)<br>endif()<br><br>if (DEFINED FOO)<br>    message(&quot;At 1: FOO is defined&quot;)<br>else()<br>    message(&quot;At 1: FOO is NOT defined&quot;)<br>endif()<br><br>set(FOO &quot;foo&quot;)<br>
<br>if (DEFINED FOO)<br>    message(&quot;At 2:FOO is defined&quot;)<br>else()<br>    message(&quot;At 2:FOO is NOT defined&quot;)<br>endif()<br></div><br>When run it prints this:<br><br><div style="margin-left: 40px;">HOME: /user/grc<br>
HOME is NOT defined<br>At 1: FOO is NOT defined<br>At 2:FOO is defined<br></div><br>So the test for if a variable is defined works for cmake variables but not for environment variables.  I can work around this by testing if the environment variable is the empty string I guess.  Is the current behaviour what is wanted, or is this a bug ?<br>
<br>--<br>Glenn<br><br>