Apply CMake test-time config to all tests

We configure an EnforceConfig.cmake script to load at CTest time.
Previously we loaded it from Tests/CTestTestfile.cmake, but now we load
it from the top level so it applies to all tests.
This commit is contained in:
Brad King 2009-12-10 10:33:42 -05:00
parent 08ac33fe6a
commit 9d823f7847
2 changed files with 4 additions and 4 deletions

View File

@ -342,6 +342,10 @@ SET(CMake_VERSION_FULL "${CMake_VERSION}.${CMake_VERSION_PATCH}")
ENABLE_TESTING()
INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake)
# Set up test-time configuration.
SET_DIRECTORY_PROPERTIES(PROPERTIES
TEST_INCLUDE_FILE "${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake")
# where to write the resulting executables and libraries
SET(BUILD_SHARED_LIBS OFF)
SET(EXECUTABLE_OUTPUT_PATH "" CACHE INTERNAL "No configurable exe dir.")

View File

@ -28,12 +28,8 @@ IF(NOT CMAKE_CONFIGURATION_TYPES AND CMAKE_BUILD_TYPE)
SET(CTestTest_CONFIG ${CMAKE_BUILD_TYPE})
ENDIF()
# Make sure the 'testing' test gets a proper configuration.
CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in
${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake @ONLY)
SET_DIRECTORY_PROPERTIES(PROPERTIES
TEST_INCLUDE_FILE "${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake"
)
# Testing
IF(BUILD_TESTING)