summaryrefslogtreecommitdiffstats
path: root/Tests/ExternalProject/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-02-04 21:18:35 (GMT)
committerBrad King <brad.king@kitware.com>2022-02-07 16:53:29 (GMT)
commit7cf5355d5e3efeac7cd421fa5ac8f029ccf408d7 (patch)
tree0143b7bbae839ffbb1feba27f20d595e3ae16cd5 /Tests/ExternalProject/CMakeLists.txt
parentc8b29dc5b93d541052537b3e7b19069f4c2370d0 (diff)
downloadCMake-7cf5355d5e3efeac7cd421fa5ac8f029ccf408d7.zip
CMake-7cf5355d5e3efeac7cd421fa5ac8f029ccf408d7.tar.gz
CMake-7cf5355d5e3efeac7cd421fa5ac8f029ccf408d7.tar.bz2
Tests: Add cache entries to control ExternalProject test VCS tools
Add undocumented `CMake_TEST_ExternalProject_*` cache entries to explicitly enable or disable these tests. If not set, compute defaults as before. Also consolidate the VCS default heuristics.
Diffstat (limited to 'Tests/ExternalProject/CMakeLists.txt')
-rw-r--r--Tests/ExternalProject/CMakeLists.txt135
1 files changed, 51 insertions, 84 deletions
diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt
index 8a85045..e4c6c66 100644
--- a/Tests/ExternalProject/CMakeLists.txt
+++ b/Tests/ExternalProject/CMakeLists.txt
@@ -8,10 +8,50 @@ include(ExternalProject)
# Test ExternalProject, especially with checkouts from VCS
-find_package(CVS)
-find_package(Subversion)
-find_package(Git)
-find_package(Hg)
+if(NOT DEFINED EP_TEST_CVS OR EP_TEST_CVS)
+ find_package(CVS)
+endif()
+if(NOT DEFINED EP_TEST_CVS AND CVS_FOUND AND (UNIX OR NOT "${CVS_EXECUTABLE}" MATCHES "cygwin"))
+ set(EP_TEST_CVS 1)
+endif()
+
+if(NOT DEFINED EP_TEST_SVN OR EP_TEST_SVN)
+ find_package(Subversion)
+ if(Subversion_FOUND AND Subversion_VERSION_SVN VERSION_LESS 1.2)
+ message(STATUS "No ExternalProject svn tests with svn client less than version 1.2")
+ set(Subversion_FOUND 0)
+ endif()
+ # Only do svn tests in cygwin/cygwin or not-cygwin/not-cygwin arrangements:
+ if(Subversion_FOUND AND CMAKE_CURRENT_BINARY_DIR MATCHES "cygdrive/" AND NOT "${Subversion_SVN_EXECUTABLE}" MATCHES "cygwin")
+ message(STATUS "No ExternalProject svn tests with non-cygwin svn client in a /cygdrive based build")
+ set(Subversion_FOUND 0)
+ endif()
+endif()
+if(NOT DEFINED EP_TEST_SVN AND Subversion_FOUND)
+ set(EP_TEST_SVN 1)
+endif()
+
+if(NOT DEFINED EP_TEST_GIT OR EP_TEST_GIT)
+ find_package(Git)
+endif()
+if(NOT DEFINED EP_TEST_GIT AND Git_FOUND)
+ message(STATUS "GIT_VERSION_STRING='${GIT_VERSION_STRING}'")
+ if(NOT "${GIT_VERSION_STRING}" VERSION_LESS 1.6.5)
+ set(EP_TEST_GIT 1)
+ endif()
+endif()
+
+if(NOT DEFINED EP_TEST_HG OR EP_TEST_HG)
+ find_package(Hg)
+endif()
+if(NOT DEFINED EP_TEST_HG AND Hg_FOUND)
+ set(EP_TEST_HG 1)
+endif()
+
+message(STATUS "EP_TEST_CVS='${EP_TEST_CVS}' CVS_EXECUTABLE='${CVS_EXECUTABLE}'")
+message(STATUS "EP_TEST_SVN='${EP_TEST_SVN}' Subversion_SVN_EXECUTABLE='${Subversion_SVN_EXECUTABLE}'")
+message(STATUS "EP_TEST_GIT='${EP_TEST_GIT}' GIT_EXECUTABLE='${GIT_EXECUTABLE}'")
+message(STATUS "EP_TEST_HG='${EP_TEST_HG}' HG_EXECUTABLE='${HG_EXECUTABLE}'")
option(ExternalProjectTest_USE_FOLDERS "Enable folder grouping in IDEs." ON)
if(ExternalProjectTest_USE_FOLDERS)
@@ -115,20 +155,7 @@ ExternalProject_Add(${proj}
# CVS-based tests:
#
-set(do_cvs_tests 0)
-
-if(CVS_EXECUTABLE)
- set(do_cvs_tests 1)
-endif()
-
-if(do_cvs_tests AND NOT UNIX)
- if("${CVS_EXECUTABLE}" MATCHES "cygwin")
- message(STATUS "No ExternalProject cvs tests with cygwin cvs.exe outside cygwin!")
- set(do_cvs_tests 0)
- endif()
-endif()
-
-if(do_cvs_tests)
+if(EP_TEST_CVS)
# Unzip/untar the CVS repository in our source folder so that other
# projects below may use it to test CVS args of ExternalProject_Add
#
@@ -207,32 +234,7 @@ endif()
# SVN-based tests:
#
-set(do_svn_tests 0)
-
-if(Subversion_SVN_EXECUTABLE)
- set(do_svn_tests 1)
-endif()
-
-# Only do svn tests with svn >= version 1.2
-#
-if(do_svn_tests)
- if(Subversion_VERSION_SVN VERSION_LESS 1.2)
- message(STATUS "No ExternalProject svn tests with svn client less than version 1.2")
- set(do_svn_tests 0)
- endif()
-endif()
-
-# Only do svn tests in cygwin/cygwin or not-cygwin/not-cygwin arrangements:
-#
-if(do_svn_tests)
- if(CMAKE_CURRENT_BINARY_DIR MATCHES "cygdrive/" AND
- NOT "${Subversion_SVN_EXECUTABLE}" MATCHES "cygwin")
- message(STATUS "No ExternalProject svn tests with non-cygwin svn client in a /cygdrive based build")
- set(do_svn_tests 0)
- endif()
-endif()
-
-if(do_svn_tests)
+if(EP_TEST_SVN)
# Unzip/untar the SVN repository in our source folder so that other
# projects below may use it to test SVN args of ExternalProject_Add
#
@@ -292,22 +294,7 @@ if(do_svn_tests)
set_property(TARGET ${proj} PROPERTY FOLDER "SVN")
endif()
-
-set(do_git_tests 0)
-
-if(GIT_EXECUTABLE)
- set(do_git_tests 1)
-
- message(STATUS "GIT_VERSION_STRING='${GIT_VERSION_STRING}'")
-
- if("${GIT_VERSION_STRING}" VERSION_LESS 1.6.5)
- message(STATUS "No ExternalProject git tests with git client less than version 1.6.5")
- set(do_git_tests 0)
- endif()
-endif()
-
-
-if(do_git_tests)
+if(EP_TEST_GIT)
set(local_git_repo "../../LocalRepositories/GIT")
# Unzip/untar the git repository in our source folder so that other
@@ -554,20 +541,7 @@ if(do_git_tests)
endif()
-set(do_hg_tests 0)
-
-if(HG_EXECUTABLE)
- set(do_hg_tests 1)
-endif()
-
-if(do_hg_tests AND NOT UNIX)
- if("${HG_EXECUTABLE}" MATCHES "cygwin")
- message(STATUS "No ExternalProject hg tests with cygwin hg outside cygwin!")
- set(do_hg_tests 0)
- endif()
-endif()
-
-if(do_hg_tests)
+if(EP_TEST_HG)
set(local_hg_repo "../../LocalRepositories/HG")
# Unzip/untar the hg repository in our source folder so that other
@@ -642,7 +616,7 @@ enable_testing()
#
# BuildTree tests:
#
-if(do_cvs_tests)
+if(EP_TEST_CVS)
add_test(TutorialStep1-CVS-20090626-BuildTreeTest
"${binary_base}/TutorialStep1-CVS-20090626/Tutorial" 4)
@@ -653,7 +627,7 @@ if(do_cvs_tests)
"${binary_base}/TutorialStep1-CVS-HEAD/Tutorial" 81)
endif()
-if(do_svn_tests)
+if(EP_TEST_SVN)
add_test(TutorialStep1-SVN-20090626-BuildTreeTest
"${binary_base}/TutorialStep1-SVN-20090626/Tutorial" 100)
@@ -664,7 +638,7 @@ if(do_svn_tests)
"${binary_base}/TutorialStep1-SVN-trunk/Tutorial" 98)
endif()
-if(do_git_tests)
+if(EP_TEST_GIT)
add_test(TutorialStep1-GIT-byhash
${CMAKE_COMMAND} -P "${binary_base}/TutorialStep1-GIT-byhash/example.cmake")
@@ -686,13 +660,6 @@ if(do_git_tests)
endif()
endif()
-
-message(STATUS "do_cvs_tests='${do_cvs_tests}'")
-message(STATUS "do_svn_tests='${do_svn_tests}'")
-message(STATUS "do_git_tests='${do_git_tests}' GIT_EXECUTABLE='${GIT_EXECUTABLE}'")
-message(STATUS "do_hg_tests='${do_hg_tests}' HG_EXECUTABLE='${HG_EXECUTABLE}'")
-
-
# Test if log works when the first arguments of *_COMMAND is "COMMAND".
set(proj ExternalProject-no-log)
set(download_cmd "")