Browse Source

Merge topic 'test-no-git'

15d9d591bd Tests: Require git to enable RunCMake.CMP0150 test
0c2610bd30 Tests: Find GIT_EXECUTABLE early enough to use in all tests

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Merge-request: !8556
Brad King 2 years ago
parent
commit
37b4eda100
2 changed files with 7 additions and 5 deletions
  1. 3 4
      Tests/CMakeLists.txt
  2. 4 1
      Tests/RunCMake/CMakeLists.txt

+ 3 - 4
Tests/CMakeLists.txt

@@ -142,6 +142,9 @@ if(BUILD_TESTING)
       )
       )
   endif()
   endif()
 
 
+  # Look for git to use for tests.
+  find_program(GIT_EXECUTABLE NAMES git)
+
   # Look for rpmbuild to use for tests.
   # Look for rpmbuild to use for tests.
   # The tool does not work with spaces in the path.
   # The tool does not work with spaces in the path.
   if(NOT CMAKE_CURRENT_BINARY_DIR MATCHES " ")
   if(NOT CMAKE_CURRENT_BINARY_DIR MATCHES " ")
@@ -2688,10 +2691,6 @@ if(BUILD_TESTING)
   endif()
   endif()
 
 
   # Test CTest Update with GIT
   # Test CTest Update with GIT
-  if(NOT DEFINED CMake_TEST_CTestUpdate_GIT OR CMake_TEST_CTestUpdate_GIT)
-    find_program(GIT_EXECUTABLE NAMES git)
-    mark_as_advanced(GIT_EXECUTABLE)
-  endif()
   if(NOT DEFINED CMake_TEST_CTestUpdate_GIT AND GIT_EXECUTABLE
   if(NOT DEFINED CMake_TEST_CTestUpdate_GIT AND GIT_EXECUTABLE
       AND (UNIX OR NOT "${GIT_EXECUTABLE}" MATCHES "cygwin"))
       AND (UNIX OR NOT "${GIT_EXECUTABLE}" MATCHES "cygwin"))
     set(CMake_TEST_CTestUpdate_GIT 1)
     set(CMake_TEST_CTestUpdate_GIT 1)

+ 4 - 1
Tests/RunCMake/CMakeLists.txt

@@ -160,7 +160,10 @@ endif()
 add_RunCMake_test(CMP0132)
 add_RunCMake_test(CMP0132)
 add_RunCMake_test(CMP0135)
 add_RunCMake_test(CMP0135)
 add_RunCMake_test(CMP0139)
 add_RunCMake_test(CMP0139)
-add_RunCMake_test(CMP0150)
+
+if(GIT_EXECUTABLE)
+  add_RunCMake_test(CMP0150)
+endif()
 
 
 # The test for Policy 65 requires the use of the
 # The test for Policy 65 requires the use of the
 # CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode
 # CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode