diff options
author | Brad King <brad.king@kitware.com> | 2014-03-03 20:24:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-03-03 20:49:17 (GMT) |
commit | 9608ef6f402bc5730dbf3276abf27b4e4b1abb2b (patch) | |
tree | d36a1c7a4d1d7965ce4f50203def0fd96f3e4a19 /Tests/CMakeLists.txt | |
parent | 9f5bd180c8e0114ff153deeaa1690ce9eb250005 (diff) | |
download | CMake-9608ef6f402bc5730dbf3276abf27b4e4b1abb2b.zip CMake-9608ef6f402bc5730dbf3276abf27b4e4b1abb2b.tar.gz CMake-9608ef6f402bc5730dbf3276abf27b4e4b1abb2b.tar.bz2 |
Tests: Optionally configure tests exclusively, with an external CMake
Add an undocumented CMake_TEST_EXTERNAL_CMAKE option to name an external
CMake 'bin' directory. Skip all main CMake binary builds and instead
configure the Tests directory to run using the external CMake provided.
This will provide a means to exercise the CMake test suite generating
for target platforms and compilers with which the CMake source does not
build. That will allow us to raise the level of C++ features required
of a compiler to build our source while retaining tests for generating
projects with older compiler tools.
Diffstat (limited to 'Tests/CMakeLists.txt')
-rw-r--r-- | Tests/CMakeLists.txt | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 1c7f29c..854b239 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -57,8 +57,10 @@ if(BUILD_TESTING) set(CMake_TEST_EXPLICIT_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM}") endif() - if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_GENERATOR}" MATCHES Ninja AND NOT WIN32)) - set(TEST_CompileCommandOutput 1) + if(NOT CMake_TEST_EXTERNAL_CMAKE) + if("${CMAKE_GENERATOR}" MATCHES "Unix Makefiles" OR ("${CMAKE_GENERATOR}" MATCHES Ninja AND NOT WIN32)) + set(TEST_CompileCommandOutput 1) + endif() endif() set(MAKE_IS_GNU ) @@ -95,13 +97,17 @@ if(BUILD_TESTING) list(APPEND build_options -DCMAKE_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}) endif() - add_subdirectory(CMakeLib) + if(NOT CMake_TEST_EXTERNAL_CMAKE) + add_subdirectory(CMakeLib) + endif() add_subdirectory(CMakeOnly) add_subdirectory(RunCMake) add_subdirectory(FindPackageModeMakefileTest) - add_subdirectory(CTestTestMemcheck) + if(NOT CMake_TEST_EXTERNAL_CMAKE) + add_subdirectory(CTestTestMemcheck) + endif() # Collect a list of all test build directories. set(TEST_BUILD_DIRS) @@ -248,7 +254,9 @@ if(BUILD_TESTING) ADD_TEST_MACRO(SetLang SetLang) ADD_TEST_MACRO(EmptyProperty EmptyProperty) ADD_TEST_MACRO(ExternalOBJ ExternalOBJ) - ADD_TEST_MACRO(LoadCommand LoadedCommand) + if(NOT CMake_TEST_EXTERNAL_CMAKE) + ADD_TEST_MACRO(LoadCommand LoadedCommand) + endif() ADD_TEST_MACRO(LinkDirectory bin/LinkDirectory) ADD_TEST_MACRO(LinkLanguage LinkLanguage) ADD_TEST_MACRO(LinkLine LinkLine) @@ -1018,16 +1026,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ "${CMake_BINARY_DIR}/Tests/CMakeTestMultipleConfigures") endif() - add_test(LoadedCommandOneConfig ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/LoadCommandOneConfig" - "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig" - ${build_generator_args} - --build-project LoadCommand - --build-options ${build_options} - --test-command LoadedCommand - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig") + if(NOT CMake_TEST_EXTERNAL_CMAKE) + add_test(LoadedCommandOneConfig ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/LoadCommandOneConfig" + "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig" + ${build_generator_args} + --build-project LoadCommand + --build-options ${build_options} + --test-command LoadedCommand + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig") + endif() add_test(complex ${CMAKE_CTEST_COMMAND} --build-and-test @@ -2771,5 +2781,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ WORKING_DIRECTORY ${CMake_BINARY_DIR}/Utilities/KWStyle) endif() - add_subdirectory(CMakeTests) + if(NOT CMake_TEST_EXTERNAL_CMAKE) + add_subdirectory(CMakeTests) + endif() endif() |