diff options
author | Craig Scott <craig.scott@crascit.com> | 2021-01-20 10:15:45 +1100 |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2021-01-20 10:16:21 +1100 |
commit | 315a200f0c45415e8ab0da058aab9bbfa39c3c05 (patch) | |
tree | 6feb6f39b8dacadc4a6509c0404f48a2f7d1c4cc /Modules/FetchContent | |
parent | ddd9545895326e45bee798ae0b5a5d2bf8dae239 (diff) | |
download | cmake-315a200f0c45415e8ab0da058aab9bbfa39c3c05.tar.gz |
FindGit: Cache the GIT_EXECUTABLE version for the current run
The git version should not change while CMake is running. When
using FetchContent with many dependencies, the repeated calls
to get the git version every time ExternalProject is used can be
measurable on some platforms. This commit queries that version
only once and then caches it in a global property for the rest of that
run. The git version can still safely change between runs because it
is not cached, only the GIT_EXECUTABLE location is cached.
Relates: #21703
Diffstat (limited to 'Modules/FetchContent')
-rw-r--r-- | Modules/FetchContent/CMakeLists.cmake.in | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/FetchContent/CMakeLists.cmake.in b/Modules/FetchContent/CMakeLists.cmake.in index 45e4df03ef..5ebb12f1ad 100644 --- a/Modules/FetchContent/CMakeLists.cmake.in +++ b/Modules/FetchContent/CMakeLists.cmake.in @@ -9,6 +9,8 @@ cmake_minimum_required(VERSION ${CMAKE_VERSION}) project(${contentName}-populate NONE) +@__FETCHCONTENT_CACHED_INFO@ + include(ExternalProject) ExternalProject_Add(${contentName}-populate ${ARG_EXTRA} |