ENH: set expected failure for tests
[cmake.git] / Tests / EnforceConfig.cmake.in
blobc10d2a319343260f05f04e12a7f85fa7fe2b5001
1 # Older versions of CMake do not support an empty configuration name in
2 # CTEST_CONFIGURATION_TYPE for the 'testing' test.
3 SET(CONFIG_REQUIRED)
4 IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6)
5   SET(CONFIG_REQUIRED 1)
6 ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6)
7   IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL 2.6)
8     IF("${CMAKE_PATCH_VERSION}" LESS 3)
9       SET(CONFIG_REQUIRED 1)
10    ENDIF("${CMAKE_PATCH_VERSION}" LESS 3)
11   ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL 2.6)
12 ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6)
14 IF(NOT CTEST_CONFIGURATION_TYPE AND CONFIG_REQUIRED)
15   SET(CTEST_CMD "@CMAKE_CTEST_COMMAND@@CMAKE_EXECUTABLE_SUFFIX@")
16   GET_FILENAME_COMPONENT(CTEST_DIR "${CTEST_CMD}" PATH)
17   GET_FILENAME_COMPONENT(CTEST_EXE "${CTEST_CMD}" NAME)
18   FOREACH(cfg Release Debug MinSizeRel RelWithDebInfo)
19     IF(NOT CTEST_CONFIGURATION_TYPE)
20       IF(EXISTS "${CTEST_DIR}/${cfg}/${CTEST_EXE}")
21         SET(CTEST_CONFIGURATION_TYPE ${cfg})
22       ENDIF(EXISTS "${CTEST_DIR}/${cfg}/${CTEST_EXE}")
23     ENDIF(NOT CTEST_CONFIGURATION_TYPE)
24   ENDFOREACH(cfg)
25   IF(NOT CTEST_CONFIGURATION_TYPE)
26     SET(CTEST_CONFIGURATION_TYPE NoConfig)
27   ENDIF(NOT CTEST_CONFIGURATION_TYPE)
28   MESSAGE("Guessing configuration ${CTEST_CONFIGURATION_TYPE}")
29 ENDIF(NOT CTEST_CONFIGURATION_TYPE AND CONFIG_REQUIRED)