<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>How do I set an environment variable so that it is visible globally in CMake? &nbsp;Specifically, I want to have it visible when I run something like:</div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">#-----------------------------------</blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"># set the environment variable value</blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">set( ENV{myVariable} ... )</blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><br></blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"># run a test through a CMake script that requires the environment variable set above.<br>add_test( myTest<br>&nbsp;&nbsp;${CMAKE_COMMAND}<br>&nbsp;&nbsp;-D exe_name:STRING=myExecutable<br>&nbsp;&nbsp;-P ${PROJECT_SOURCE_DIR}/test_problems/run_test.cmake<br>&nbsp;&nbsp;)</blockquote><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">#-----------------------------------</blockquote><div><div><br></div><div>In the "run_test.cmake" file I would like to have "myVariable" available as an environment variable, but it is not, despite the fact that it was set prior to the execution of "run_test.cmake".</div><div><br></div><div>What am I missing here?</div><div><br></div><div>James</div></div>
<br></body></html>