[cmake-developers] add_custom_command differences in tests

Brad King brad.king at kitware.com
Mon Feb 10 10:28:24 EST 2014


On 02/07/2014 05:19 PM, Steve Wilson wrote:
> On Feb 7, 2014, at 3:01 PM, Brad King wrote:
>> -DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE}
> 
> I have tried adding that to my test call (--build-options) but it doesn't seem to make any difference.

Oops, I picked the wrong line for an example.  We need to pass
the test configuration to the invocation of ctest --build-and-test.
In your example change:

  add_test(CustomCommand.CONFIG  ${CMAKE_CTEST_COMMAND}
    --build-and-test
    ...
    )

to:

  add_test(CustomCommand.CONFIG
    ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
    --build-and-test
    ...
    )

That will ensure that the test project builds as the tested config.

-Brad




More information about the cmake-developers mailing list