[CMake] ctest - how to set environment

Jörg Becker news at elke-joerg.de
Tue Feb 19 04:04:49 EST 2008


Hi,

I just started using CMake (2.4) and I'm very happy about the easy build 
setup. Encouraged by this quick success I tried to enable testing. But I 
cannot get working the tests correctly.
My test executable needs an environment variable, which is not set in my 
standard session. As I understood the doku I can set environment variables 
for the test session by "set( CTEST_ENVIRONMENT...", but this doesn't work as 
expected. Here is my test setup:


My test executable is the following shell script:

echo ICU_DATA: ${ICU_DATA}


The test part of my CMakeLists.txt looks like this (enable_testing() called in 
top dir):

set( CTEST_ENVIRONMENT "ICU_DATA=bla" )
add_test( EnvTest ${output_directory}/test )


Unfortunately the result in LastTest.log looks like this:
"ICU_DATA:" 

where I expect "ICU_DATA: bla"


Can anybody put some light on the environment variable handling for testing 
sessions?


Thanks

Jörg


More information about the CMake mailing list