Hi,<br><br>I'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("HOME: $ENV{HOME}")<br>if (DEFINED $ENV{HOME})<br> message("HOME is defined")<br>else()<br>
message("HOME is NOT defined")<br>endif()<br><br>if (DEFINED FOO)<br> message("At 1: FOO is defined")<br>else()<br> message("At 1: FOO is NOT defined")<br>endif()<br><br>set(FOO "foo")<br>
<br>if (DEFINED FOO)<br> message("At 2:FOO is defined")<br>else()<br> message("At 2:FOO is NOT defined")<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>