[CMake] Trouble with set_test_properties

tibur tiburtibur at gmail.com
Fri Nov 26 10:03:00 EST 2010


Hello.
I have some trouble with set_test_properties function.
Let's say I want to add something to the environment (DLL path for 
instance). I use the following code in my CMakeLists.txt:

set_tests_properties(Prog PROPERTIES ENVIRONMENT 
"CONFIG=${CTEST_CONFIGURATION_TYPE}")

When processed by cmake, the resulting CtestTestfile.cmake shows:

SET_TESTS_PROPERTIES(Prog PROPERTIES  ENVIRONMENT "CONFIG=")

That's fine, I need to protect the variable using:

set_tests_properties(Prog PROPERTIES ENVIRONMENT 
"CONFIG=\${CTEST_CONFIGURATION_TYPE}")

But the resulting CTestTestfile.cmake shows:

SET_TESTS_PROPERTIES(Prog PROPERTIES  ENVIRONMENT 
"CONFIG=\${CTEST_CONFIGURATION_TYPE}")

Which won't get expanded while running ctest!
How could I make my variable get expanded by ctest and not by cmake?

How can I solve my problem?
Thanks.


More information about the CMake mailing list