[CMake] ${CTEST_CONFIGURATION_TYPE} expanded to an empty string while running ctest

Brad King brad.king at kitware.com
Wed Jun 21 15:54:14 EDT 2006


Gaetan Lehmann wrote:
> On Wednesday 21 June 2006 21:12, Brad King wrote:
>> Gaetan Lehmann wrote:
>>> Hi,
>>>
>>> I'm trying to run a different code some test with different path
>>> depending of the configuration (debug, release, ...) with Xcode and
>>> cmake 2.4.2
>>>
>>> I have seen on the mailing list that ${CTEST_CONFIGURATION_TYPE} should
>>> be expanded to the configuration type. However, it seem to be expanded
>>> to an empty string.
>>>
>>> ADD_TEST(mytest echo "testing \${CTEST_CONFIGURATION_TYPE}")
>>>
>>> produce:
>>>
>>> Start processing tests
>>> Test project
>>> Constructing a list of tests
>>> Done constructing a list of tests
>>> Changing directory into
>>> /Users/glehmann/src/contrib-itk/WrapITK/build-xcode/Python/Tests
>>>   1/ 33 Testing mytest
>>> Test command: /bin/echo testing\
>>> testing
>>> -- Process completed
>>>    Passed
>>>
>>> The following tests passed:
>>>         mytest
>>>
>>> 100% tests passed, 0 tests failed out of 1
>>>
>>>
>>> What is the right way to use configuration type with tests ?
>> This is correct, but you actually have to specify a configuration type
>> when running tests.  Try running the tests like this:
>>
>> ctest -R mytest -C Debug
>>
> 
> It works :-)
> Would it be possible to use the configuration used for the last build by 
> default ?

In a single-configuration generator like "Unix Makefiles" the test 
program can be hard-coded to use the selected configuration using a 
configured header.  In a multi-configuration generator like "Visual 
Studio 7 .NET 2003" the configuration will have to be specified every 
time anyway.

-Brad


More information about the CMake mailing list