EnforceConfig.cmake.in 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Choose a configuration with which to drive CTest tests.
  2. IF(CTEST_CONFIGURATION_TYPE)
  3. SET(CTestTest_CONFIG "${CTEST_CONFIGURATION_TYPE}")
  4. ELSE(CTEST_CONFIGURATION_TYPE)
  5. SET(CTestTest_CONFIG "@CTestTest_CONFIG@")
  6. ENDIF(CTEST_CONFIGURATION_TYPE)
  7. # Older versions of CMake do not support an empty configuration name in
  8. # CTEST_CONFIGURATION_TYPE for the 'testing' test.
  9. SET(CONFIG_REQUIRED)
  10. IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6)
  11. SET(CONFIG_REQUIRED 1)
  12. ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6)
  13. IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL 2.6)
  14. IF("${CMAKE_PATCH_VERSION}" LESS 3)
  15. SET(CONFIG_REQUIRED 1)
  16. ENDIF("${CMAKE_PATCH_VERSION}" LESS 3)
  17. ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" STREQUAL 2.6)
  18. ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6)
  19. IF(NOT CTEST_CONFIGURATION_TYPE AND CONFIG_REQUIRED)
  20. SET(CTEST_CMD "@CMAKE_CTEST_COMMAND@@CMAKE_EXECUTABLE_SUFFIX@")
  21. GET_FILENAME_COMPONENT(CTEST_DIR "${CTEST_CMD}" PATH)
  22. GET_FILENAME_COMPONENT(CTEST_EXE "${CTEST_CMD}" NAME)
  23. FOREACH(cfg Release Debug MinSizeRel RelWithDebInfo)
  24. IF(NOT CTEST_CONFIGURATION_TYPE)
  25. IF(EXISTS "${CTEST_DIR}/${cfg}/${CTEST_EXE}")
  26. SET(CTEST_CONFIGURATION_TYPE ${cfg})
  27. ENDIF(EXISTS "${CTEST_DIR}/${cfg}/${CTEST_EXE}")
  28. ENDIF(NOT CTEST_CONFIGURATION_TYPE)
  29. ENDFOREACH(cfg)
  30. IF(NOT CTEST_CONFIGURATION_TYPE)
  31. SET(CTEST_CONFIGURATION_TYPE NoConfig)
  32. ENDIF(NOT CTEST_CONFIGURATION_TYPE)
  33. MESSAGE("Guessing configuration ${CTEST_CONFIGURATION_TYPE}")
  34. ENDIF(NOT CTEST_CONFIGURATION_TYPE AND CONFIG_REQUIRED)
  35. @TEST_HOME_ENV_CODE@