From 9608ef6f402bc5730dbf3276abf27b4e4b1abb2b Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 3 Mar 2014 15:24:03 -0500 Subject: [PATCH] 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. --- CMakeLists.txt | 306 +++++++++++++++++++++++-------------------- Tests/CMakeLists.txt | 44 ++++--- 2 files changed, 195 insertions(+), 155 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a04383885..5f8301505 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,9 @@ if(CMAKE_BOOTSTRAP) unset(CMAKE_BOOTSTRAP CACHE) endif() -set(CMake_BIN_DIR ${CMake_BINARY_DIR}/bin) +if(NOT CMake_TEST_EXTERNAL_CMAKE) + set(CMake_BIN_DIR ${CMake_BINARY_DIR}/bin) +endif() if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}") # Disallow architecture-specific try_run. It may not run on the host. @@ -102,9 +104,11 @@ endmacro() -set(CMAKE_BUILD_ON_VISUAL_STUDIO 0) -if(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW ) - set(CMAKE_BUILD_ON_VISUAL_STUDIO 1) +if(NOT CMake_TEST_EXTERNAL_CMAKE) + set(CMAKE_BUILD_ON_VISUAL_STUDIO 0) + if(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW ) + set(CMAKE_BUILD_ON_VISUAL_STUDIO 1) + endif() endif() @@ -126,9 +130,19 @@ macro(CMAKE_SETUP_TESTING) # the ctest from this cmake is used for testing # and not the ctest from the cmake building and testing # cmake. - set(CMAKE_CTEST_COMMAND "${CMake_BIN_DIR}/ctest") - set(CMAKE_CMAKE_COMMAND "${CMake_BIN_DIR}/cmake") - set(CMAKE_CPACK_COMMAND "${CMake_BIN_DIR}/cpack") + if(CMake_TEST_EXTERNAL_CMAKE) + set(CMAKE_CTEST_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/ctest") + set(CMAKE_CMAKE_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/cmake") + set(CMAKE_CPACK_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/cpack") + foreach(exe cmake ctest cpack) + add_executable(${exe} IMPORTED) + set_property(TARGET ${exe} PROPERTY IMPORTED_LOCATION ${CMake_TEST_EXTERNAL_CMAKE}/${exe}) + endforeach() + else() + set(CMAKE_CTEST_COMMAND "${CMake_BIN_DIR}/ctest") + set(CMAKE_CMAKE_COMMAND "${CMake_BIN_DIR}/cmake") + set(CMAKE_CPACK_COMMAND "${CMake_BIN_DIR}/cpack") + endif() endif() # configure some files for testing @@ -362,18 +376,20 @@ macro (CMAKE_BUILD_UTILITIES) endmacro () #----------------------------------------------------------------------- -if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD") - execute_process(COMMAND ${CMAKE_CXX_COMPILER} - ${CMAKE_CXX_COMPILER_ARG1} -dumpversion - OUTPUT_VARIABLE _GXX_VERSION - ) - string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" - _GXX_VERSION_SHORT ${_GXX_VERSION}) - if(_GXX_VERSION_SHORT EQUAL 33) - message(FATAL_ERROR - "GXX 3.3 on OpenBSD is known to cause CPack to Crash.\n" - "Please use GXX 4.2 or greater to build CMake on OpenBSD\n" - "${CMAKE_CXX_COMPILER} version is: ${_GXX_VERSION}") +if(NOT CMake_TEST_EXTERNAL_CMAKE) + if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD") + execute_process(COMMAND ${CMAKE_CXX_COMPILER} + ${CMAKE_CXX_COMPILER_ARG1} -dumpversion + OUTPUT_VARIABLE _GXX_VERSION + ) + string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" + _GXX_VERSION_SHORT ${_GXX_VERSION}) + if(_GXX_VERSION_SHORT EQUAL 33) + message(FATAL_ERROR + "GXX 3.3 on OpenBSD is known to cause CPack to Crash.\n" + "Please use GXX 4.2 or greater to build CMake on OpenBSD\n" + "${CMAKE_CXX_COMPILER} version is: ${_GXX_VERSION}") + endif() endif() endif() @@ -392,31 +408,33 @@ include (${CMAKE_ROOT}/Modules/Dart.cmake) 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.") -set(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL - "Where to put the libraries for CMake") +if(NOT CMake_TEST_EXTERNAL_CMAKE) + # where to write the resulting executables and libraries + set(BUILD_SHARED_LIBS OFF) + set(EXECUTABLE_OUTPUT_PATH "" CACHE INTERNAL "No configurable exe dir.") + set(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL + "Where to put the libraries for CMake") -# The CMake executables usually do not need any rpath to run in the build or -# install tree. -set(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.") + # The CMake executables usually do not need any rpath to run in the build or + # install tree. + set(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.") -# Load install destinations. -include(Source/CMakeInstallDestinations.cmake) + # Load install destinations. + include(Source/CMakeInstallDestinations.cmake) -if(BUILD_TESTING) - include(${CMake_SOURCE_DIR}/Tests/CMakeInstall.cmake) + if(BUILD_TESTING) + include(${CMake_SOURCE_DIR}/Tests/CMakeInstall.cmake) + endif() + + # include special compile flags for some compilers + include(CompileFlags.cmake) + + # no clue why we are testing for this here + include(CheckSymbolExists) + CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV) + CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE) endif() -# include special compile flags for some compilers -include(CompileFlags.cmake) - -# no clue why we are testing for this here -include(CheckSymbolExists) -CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV) -CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE) - # CMAKE_TESTS_CDASH_SERVER: CDash server used by CMake/Tests. # # If not defined or "", this variable defaults to the server at @@ -434,70 +452,73 @@ if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x") set(CMAKE_TESTS_CDASH_SERVER "http://www.cdash.org/CDash") endif() -# build the utilities (a macro defined in this file) -CMAKE_BUILD_UTILITIES() +if(NOT CMake_TEST_EXTERNAL_CMAKE) + # build the utilities (a macro defined in this file) + CMAKE_BUILD_UTILITIES() -# On NetBSD ncurses is required, since curses doesn't have the wsyncup() -# function. ncurses is installed via pkgsrc, so the library is in /usr/pkg/lib, -# which isn't in the default linker search path. So without RPATH ccmake -# doesn't run and the build doesn't succeed since ccmake is executed for -# generating the documentation. -if(BUILD_CursesDialog) - get_filename_component(_CURSES_DIR "${CURSES_LIBRARY}" PATH) - set(CURSES_NEED_RPATH FALSE) - if(NOT "${_CURSES_DIR}" STREQUAL "/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/lib64" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib64") - set(CURSES_NEED_RPATH TRUE) - endif() -endif() - -if(BUILD_QtDialog) - if(APPLE) - set(CMAKE_BUNDLE_VERSION - "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") - set(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}") - # make sure CMAKE_INSTALL_PREFIX ends in / - string(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN) - math(EXPR LEN "${LEN} -1" ) - string(SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH) - if(NOT "${ENDCH}" STREQUAL "/") - set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/") + # On NetBSD ncurses is required, since curses doesn't have the wsyncup() + # function. ncurses is installed via pkgsrc, so the library is in /usr/pkg/lib, + # which isn't in the default linker search path. So without RPATH ccmake + # doesn't run and the build doesn't succeed since ccmake is executed for + # generating the documentation. + if(BUILD_CursesDialog) + get_filename_component(_CURSES_DIR "${CURSES_LIBRARY}" PATH) + set(CURSES_NEED_RPATH FALSE) + if(NOT "${_CURSES_DIR}" STREQUAL "/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/lib64" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib64") + set(CURSES_NEED_RPATH TRUE) endif() - set(CMAKE_INSTALL_PREFIX - "${CMAKE_INSTALL_PREFIX}CMake.app/Contents") endif() - set(QT_NEED_RPATH FALSE) - if(NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib64" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib64") - set(QT_NEED_RPATH TRUE) + if(BUILD_QtDialog) + if(APPLE) + set(CMAKE_BUNDLE_VERSION + "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") + set(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}") + # make sure CMAKE_INSTALL_PREFIX ends in / + string(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN) + math(EXPR LEN "${LEN} -1" ) + string(SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH) + if(NOT "${ENDCH}" STREQUAL "/") + set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/") + endif() + set(CMAKE_INSTALL_PREFIX + "${CMAKE_INSTALL_PREFIX}CMake.app/Contents") + endif() + + set(QT_NEED_RPATH FALSE) + if(NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib64" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib64") + set(QT_NEED_RPATH TRUE) + endif() endif() + + + # The same might be true on other systems for other libraries. + # Then only enable RPATH if we have are building at least with cmake 2.4, + # since this one has much better RPATH features than cmake 2.2. + # The executables are then built with the RPATH for the libraries outside + # the build tree, which is both the build and the install RPATH. + if (UNIX) + if( CMAKE_USE_SYSTEM_CURL OR CMAKE_USE_SYSTEM_ZLIB + OR CMAKE_USE_SYSTEM_EXPAT OR CTEST_USE_XMLRPC OR CURSES_NEED_RPATH OR QT_NEED_RPATH) + set(CMAKE_SKIP_RPATH OFF CACHE INTERNAL "CMake built with RPATH.") + set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) + endif() + endif () + + + # add the uninstall support + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + @ONLY) + add_custom_target(uninstall + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") + + include (CMakeCPack.cmake) + endif() - -# The same might be true on other systems for other libraries. -# Then only enable RPATH if we have are building at least with cmake 2.4, -# since this one has much better RPATH features than cmake 2.2. -# The executables are then built with the RPATH for the libraries outside -# the build tree, which is both the build and the install RPATH. -if (UNIX) - if( CMAKE_USE_SYSTEM_CURL OR CMAKE_USE_SYSTEM_ZLIB - OR CMAKE_USE_SYSTEM_EXPAT OR CTEST_USE_XMLRPC OR CURSES_NEED_RPATH OR QT_NEED_RPATH) - set(CMAKE_SKIP_RPATH OFF CACHE INTERNAL "CMake built with RPATH.") - set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) - endif() -endif () - - -# add the uninstall support -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - @ONLY) -add_custom_target(uninstall - "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") - -include (CMakeCPack.cmake) - # setup some Testing support (a macro defined in this file) CMAKE_SETUP_TESTING() configure_file( @@ -505,62 +526,69 @@ configure_file( "${CMAKE_CURRENT_BINARY_DIR}/DartLocal.conf" COPYONLY) -if(NOT CMake_VERSION_IS_RELEASE) - if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND - NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2) - set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts - -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security - -Wmissing-format-attribute -fno-common -Wundef - ) - set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W - -Wshadow -Wpointer-arith -Wformat-security -Wundef - ) +if(NOT CMake_TEST_EXTERNAL_CMAKE) + if(NOT CMake_VERSION_IS_RELEASE) + if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND + NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2) + set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts + -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security + -Wmissing-format-attribute -fno-common -Wundef + ) + set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W + -Wshadow -Wpointer-arith -Wformat-security -Wundef + ) - foreach(FLAG_LANG C CXX) - foreach(FLAG ${${FLAG_LANG}_FLAGS_LIST}) - if(NOT " ${CMAKE_${FLAG_LANG}_FLAGS} " MATCHES " ${FLAG} ") - set(CMAKE_${FLAG_LANG}_FLAGS "${CMAKE_${FLAG_LANG}_FLAGS} ${FLAG}") - endif() + foreach(FLAG_LANG C CXX) + foreach(FLAG ${${FLAG_LANG}_FLAGS_LIST}) + if(NOT " ${CMAKE_${FLAG_LANG}_FLAGS} " MATCHES " ${FLAG} ") + set(CMAKE_${FLAG_LANG}_FLAGS "${CMAKE_${FLAG_LANG}_FLAGS} ${FLAG}") + endif() + endforeach() endforeach() - endforeach() - unset(C_FLAGS_LIST) - unset(CXX_FLAGS_LIST) + unset(C_FLAGS_LIST) + unset(CXX_FLAGS_LIST) + endif() endif() + + # build the remaining subdirectories + add_subdirectory(Source) + add_subdirectory(Utilities) endif() -# build the remaining subdirectories -add_subdirectory(Source) -add_subdirectory(Utilities) add_subdirectory(Tests) -if(BUILD_TESTING) - CMAKE_SET_TARGET_FOLDER(CMakeLibTests "Tests") -endif() -CMAKE_SET_TARGET_FOLDER(cmw9xcom "Utilities/Win9xCompat") -if(TARGET documentation) - CMAKE_SET_TARGET_FOLDER(documentation "Documentation") +if(NOT CMake_TEST_EXTERNAL_CMAKE) + if(BUILD_TESTING) + CMAKE_SET_TARGET_FOLDER(CMakeLibTests "Tests") + endif() + CMAKE_SET_TARGET_FOLDER(cmw9xcom "Utilities/Win9xCompat") + if(TARGET documentation) + CMAKE_SET_TARGET_FOLDER(documentation "Documentation") + endif() endif() # add a test add_test(SystemInformationNew "${CMAKE_CMAKE_COMMAND}" --system-information -G "${CMAKE_GENERATOR}" ) -# Install license file as it requires. -install(FILES Copyright.txt DESTINATION ${CMAKE_DOC_DIR}) +if(NOT CMake_TEST_EXTERNAL_CMAKE) + # Install license file as it requires. + install(FILES Copyright.txt DESTINATION ${CMAKE_DOC_DIR}) -# Install script directories. -install( - DIRECTORY Help Modules Templates - DESTINATION ${CMAKE_DATA_DIR} - FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE - GROUP_READ GROUP_EXECUTE - WORLD_READ WORLD_EXECUTE - PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE - GROUP_READ GROUP_EXECUTE - WORLD_READ WORLD_EXECUTE - ) + # Install script directories. + install( + DIRECTORY Help Modules Templates + DESTINATION ${CMAKE_DATA_DIR} + FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ + DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE + PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE + ) -# Install auxiliary files integrating with other tools. -add_subdirectory(Auxiliary) + # Install auxiliary files integrating with other tools. + add_subdirectory(Auxiliary) +endif() diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 1c7f29c07..854b239d6 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()