summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2019-01-11 17:01:10 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2019-01-21 15:01:56 (GMT)
commit97700e9f5b17b1631f6bfef4fec62dad88dc9319 (patch)
tree6b1490f141ce798987497712f5b498d3e137dea3 /Modules
parent02f7e997e939dbd0c753514edcd580083cebd37c (diff)
downloadCMake-97700e9f5b17b1631f6bfef4fec62dad88dc9319.zip
CMake-97700e9f5b17b1631f6bfef4fec62dad88dc9319.tar.gz
CMake-97700e9f5b17b1631f6bfef4fec62dad88dc9319.tar.bz2
FindGit: Add imported target
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindGit.cmake11
1 files changed, 11 insertions, 0 deletions
diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake
index c447a1a..900e4f5 100644
--- a/Modules/FindGit.cmake
+++ b/Modules/FindGit.cmake
@@ -5,6 +5,11 @@
FindGit
-------
+The module defines the following ``IMPORTED`` targets:
+
+``Git::Git``
+ Executable of the Git command-line client.
+
The module defines the following variables:
``GIT_EXECUTABLE``
@@ -78,6 +83,12 @@ if(GIT_EXECUTABLE)
string(REPLACE "git version " "" GIT_VERSION_STRING "${git_version}")
endif()
unset(git_version)
+
+ get_property(_findgit_role GLOBAL PROPERTY CMAKE_ROLE)
+ if(_findgit_role STREQUAL "PROJECT" AND NOT TARGET Git::Git)
+ add_executable(Git::Git IMPORTED)
+ set_property(TARGET Git::Git PROPERTY IMPORTED_LOCATION "${GIT_EXECUTABLE}")
+ endif()
endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)