[cmake-developers] Testing Config generator expression

Brad King brad.king at kitware.com
Thu Nov 1 13:02:29 EDT 2012


On 11/01/2012 11:45 AM, Stephen Kelly wrote:
> Ok, I've added a test for that, but as that test uses CMAKE_COMMAND too, 
> with makefile generators, the result will be 0000 each time.

Okay, now I see what you meant before.  Sorry.

I think just this will be sufficient (untested):

diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 8c67625..7c67c5f 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -37,6 +37,7 @@

 macro(add_RunCMake_test test)
   add_test(RunCMake.${test} ${CMAKE_CMAKE_COMMAND}
+    -DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE}
     -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}
     -DRunCMake_GENERATOR=${CMAKE_TEST_GENERATOR}
     -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test}

The CMAKE_BUILD_TYPE value will ensure that single-config generators
get the tested configuration and will be ignored by multi-config
generators which do several configs anyway.

-Brad



More information about the cmake-developers mailing list