[CMake] environment variables & scope

James C. Sutherland James.Sutherland at utah.edu
Tue Oct 20 17:13:30 EDT 2009


How do I set an environment variable so that it is visible globally in  
CMake?  Specifically, I want to have it visible when I run something  
like:

#-----------------------------------
# set the environment variable value
set( ENV{myVariable} ... )

# run a test through a CMake script that requires the environment  
variable set above.
add_test( myTest
   ${CMAKE_COMMAND}
   -D exe_name:STRING=myExecutable
   -P ${PROJECT_SOURCE_DIR}/test_problems/run_test.cmake
   )
#-----------------------------------

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".

What am I missing here?

James

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091020/12a52642/attachment.htm>


More information about the CMake mailing list