diff options
author | Brad King <brad.king@kitware.com> | 2009-01-05 19:14:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-01-05 19:14:25 (GMT) |
commit | b5f3d4be61a9613abc7288f1cf31248412bfc50d (patch) | |
tree | 2e336218243e2102ab740a808d2707ae64df8bbc /Tests/EnforceConfig.cmake.in | |
parent | 2703d51b8f382f3d20abe409b116eb0afd5051ff (diff) | |
download | CMake-b5f3d4be61a9613abc7288f1cf31248412bfc50d.zip CMake-b5f3d4be61a9613abc7288f1cf31248412bfc50d.tar.gz CMake-b5f3d4be61a9613abc7288f1cf31248412bfc50d.tar.bz2 |
ENH: Re-enable new 'testing' test mode
This fixes selection of a configuration when none is specified to find
an available configuration of the ctest test-command.
Diffstat (limited to 'Tests/EnforceConfig.cmake.in')
-rw-r--r-- | Tests/EnforceConfig.cmake.in | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Tests/EnforceConfig.cmake.in b/Tests/EnforceConfig.cmake.in new file mode 100644 index 0000000..c10d2a3 --- /dev/null +++ b/Tests/EnforceConfig.cmake.in @@ -0,0 +1,29 @@ +# Older versions of CMake do not support an empty configuration name in +# CTEST_CONFIGURATION_TYPE for the 'testing' test. +SET(CONFIG_REQUIRED) +IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6) + SET(CONFIG_REQUIRED 1) +ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6) + IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL 2.6) + IF("${CMAKE_PATCH_VERSION}" LESS 3) + SET(CONFIG_REQUIRED 1) + ENDIF("${CMAKE_PATCH_VERSION}" LESS 3) + ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL 2.6) +ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6) + +IF(NOT CTEST_CONFIGURATION_TYPE AND CONFIG_REQUIRED) + SET(CTEST_CMD "@CMAKE_CTEST_COMMAND@@CMAKE_EXECUTABLE_SUFFIX@") + GET_FILENAME_COMPONENT(CTEST_DIR "${CTEST_CMD}" PATH) + GET_FILENAME_COMPONENT(CTEST_EXE "${CTEST_CMD}" NAME) + FOREACH(cfg Release Debug MinSizeRel RelWithDebInfo) + IF(NOT CTEST_CONFIGURATION_TYPE) + IF(EXISTS "${CTEST_DIR}/${cfg}/${CTEST_EXE}") + SET(CTEST_CONFIGURATION_TYPE ${cfg}) + ENDIF(EXISTS "${CTEST_DIR}/${cfg}/${CTEST_EXE}") + ENDIF(NOT CTEST_CONFIGURATION_TYPE) + ENDFOREACH(cfg) + IF(NOT CTEST_CONFIGURATION_TYPE) + SET(CTEST_CONFIGURATION_TYPE NoConfig) + ENDIF(NOT CTEST_CONFIGURATION_TYPE) + MESSAGE("Guessing configuration ${CTEST_CONFIGURATION_TYPE}") +ENDIF(NOT CTEST_CONFIGURATION_TYPE AND CONFIG_REQUIRED) |