diff options
-rw-r--r-- | Tests/CMakeLists.txt | 5 | ||||
-rw-r--r-- | Tests/EnforceConfig.cmake | 15 |
2 files changed, 20 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 8ae3041..689c187 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -13,6 +13,11 @@ MACRO(ADD_TEST_MACRO NAME COMMAND) LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${NAME}") ENDMACRO(ADD_TEST_MACRO) +# Make sure the 'testing' test gets a proper configuration. +SET_DIRECTORY_PROPERTIES(PROPERTIES + TEST_INCLUDE_FILE "${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake" + ) + # Testing IF(BUILD_TESTING) # Collect a list of all test build directories. diff --git a/Tests/EnforceConfig.cmake b/Tests/EnforceConfig.cmake new file mode 100644 index 0000000..82b9c87 --- /dev/null +++ b/Tests/EnforceConfig.cmake @@ -0,0 +1,15 @@ +# 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_CONFIGURATION_TYPE Debug) +ENDIF(NOT CTEST_CONFIGURATION_TYPE AND CONFIG_REQUIRED) |