[CMake] Setting environment before running a test

Bill Hoffman bill.hoffman at kitware.com
Wed Oct 29 09:53:10 EDT 2008


Judicaël Bedouet wrote:
> Hello,
> 
> I have a test which must be executed in different environments. Test 
> results depend on values of environment variables.
> Is there a way to easily set environment variables before running a test 
> ? Somewhat like
> 
> ADD_TEST (TestEnv1 testEnv)
> SET_TEST_PROPERTIES (TestEnv1 PROPERTIES ENV TEST_ENV="testEnvValue1")
> SET_TEST_PROPERTIES (TestEnv1 PROPERTIES WILL_FAIL true)
> 
> ADD_TEST (TestEnv2 testEnv)
> SET_TEST_PROPERTIES (TestEnv2 PROPERTIES ENV TEST_ENV="testEnvValue2")
> 

Currently, there is not.   Please create a feature request in the bug 
tracker.   Right now the only work around would be to have the test be 
run from a cmake -P script.

-Bill


More information about the CMake mailing list