[CMake] Setting environment before running a test

David Cole david.cole at kitware.com
Wed Nov 26 15:17:21 EST 2008


This feature is now implemented in CVS CMake.
See notes in bug tracker for more info:
http://public.kitware.com/Bug/view.php?id=7885

Proper syntax is demonstrated in CMake/Tests/Environment/CMakeLists.txt, as
in:

set_tests_properties(Environment1 EchoEnvironment1 PROPERTIES
  ENVIRONMENT "CMAKE_ENVIRONMENT_TEST_VAR=Happy Thanksgiving!"
  PASS_REGULAR_EXPRESSION "CMAKE_ENV.*Happy Thanksgiving"
)


Have a good one,
David


On Wed, Oct 29, 2008 at 9:46 AM, Judicaël Bedouet <j.bedouet at infonie.fr>wrote:

> Thanks for your fast answers.
>
> Reported as http://public.kitware.com/Bug/view.php?id=7885
>
> J. Bedouet
>
>
>
> On Wed, Oct 29, 2008 at 2:53 PM, Bill Hoffman <bill.hoffman at kitware.com>wrote:
>
>> 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
>>
>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081126/2519b81e/attachment.htm>


More information about the CMake mailing list