Browse Source

Merge topic 'git-config-version-check' into release-3.20

8a9753e427 ExternalProject: Only add git config setting with git 1.7.7 or later

Acked-by: Kitware Robot <[email protected]>
Merge-request: !6145
Brad King 4 years ago
parent
commit
fe9988add3
1 changed files with 5 additions and 3 deletions
  1. 5 3
      Modules/ExternalProject.cmake

+ 5 - 3
Modules/ExternalProject.cmake

@@ -2663,9 +2663,11 @@ function(_ep_add_download_command name)
     get_property(git_progress TARGET ${name} PROPERTY _EP_GIT_PROGRESS)
     get_property(git_config TARGET ${name} PROPERTY _EP_GIT_CONFIG)
 
-    # Make checkouts quiet when checking out a git hash (this avoids the
-    # very noisy detached head message)
-    list(PREPEND git_config advice.detachedHead=false)
+    # If git supports it, make checkouts quiet when checking out a git hash.
+    # This avoids the very noisy detached head message.
+    if(GIT_VERSION_STRING VERSION_GREATER_EQUAL 1.7.7)
+      list(PREPEND git_config advice.detachedHead=false)
+    endif()
 
     # For the download step, and the git clone operation, only the repository
     # should be recorded in a configured RepositoryInfo file. If the repo