summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-07-23 20:46:38 (GMT)
committerBrad King <brad.king@kitware.com>2019-07-29 15:25:43 (GMT)
commit564bcb4cb3fa8182308d3501b9b98aee1bf837d1 (patch)
tree0dc2f13c5c467c4d736e1d8bb9af94972f3b1fb8 /Source
parentecdf38aa36cfcc897e585ba05fd6f6e738bb5157 (diff)
downloadCMake-564bcb4cb3fa8182308d3501b9b98aee1bf837d1.zip
CMake-564bcb4cb3fa8182308d3501b9b98aee1bf837d1.tar.gz
CMake-564bcb4cb3fa8182308d3501b9b98aee1bf837d1.tar.bz2
CMakeVersion: Move git logic to main script
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake33
-rw-r--r--Source/CMakeVersionSource.cmake30
2 files changed, 31 insertions, 32 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 08d3169..e406b4c 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -10,9 +10,38 @@ if("${CMake_VERSION_PATCH}" VERSION_LESS 20000000)
set(CMake_VERSION_IS_RELEASE 1)
set(CMake_VERSION_SOURCE "")
else()
- set(CMake_VERSION_IS_DIRTY 0) # may be set to 1 by CMakeVersionSource
+ set(CMake_VERSION_IS_DIRTY 0)
set(CMake_VERSION_IS_RELEASE 0)
- include(${CMake_SOURCE_DIR}/Source/CMakeVersionSource.cmake)
+ # Try to identify the current development source version.
+ set(CMake_VERSION_SOURCE "")
+ if(EXISTS ${CMake_SOURCE_DIR}/.git/HEAD)
+ find_program(GIT_EXECUTABLE NAMES git git.cmd)
+ mark_as_advanced(GIT_EXECUTABLE)
+ if(GIT_EXECUTABLE)
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} rev-parse --verify -q --short=4 HEAD
+ OUTPUT_VARIABLE head
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ WORKING_DIRECTORY ${CMake_SOURCE_DIR}
+ )
+ if(head)
+ set(CMake_VERSION_SOURCE "g${head}")
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} update-index -q --refresh
+ WORKING_DIRECTORY ${CMake_SOURCE_DIR}
+ )
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} diff-index --name-only HEAD --
+ OUTPUT_VARIABLE dirty
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ WORKING_DIRECTORY ${CMake_SOURCE_DIR}
+ )
+ if(dirty)
+ set(CMake_VERSION_IS_DIRTY 1)
+ endif()
+ endif()
+ endif()
+ endif()
endif()
# Compute the full version string.
diff --git a/Source/CMakeVersionSource.cmake b/Source/CMakeVersionSource.cmake
deleted file mode 100644
index 5ea1de3..0000000
--- a/Source/CMakeVersionSource.cmake
+++ /dev/null
@@ -1,30 +0,0 @@
-# Try to identify the current development source version.
-set(CMake_VERSION_SOURCE "")
-if(EXISTS ${CMake_SOURCE_DIR}/.git/HEAD)
- find_program(GIT_EXECUTABLE NAMES git git.cmd)
- mark_as_advanced(GIT_EXECUTABLE)
- if(GIT_EXECUTABLE)
- execute_process(
- COMMAND ${GIT_EXECUTABLE} rev-parse --verify -q --short=4 HEAD
- OUTPUT_VARIABLE head
- OUTPUT_STRIP_TRAILING_WHITESPACE
- WORKING_DIRECTORY ${CMake_SOURCE_DIR}
- )
- if(head)
- set(CMake_VERSION_SOURCE "g${head}")
- execute_process(
- COMMAND ${GIT_EXECUTABLE} update-index -q --refresh
- WORKING_DIRECTORY ${CMake_SOURCE_DIR}
- )
- execute_process(
- COMMAND ${GIT_EXECUTABLE} diff-index --name-only HEAD --
- OUTPUT_VARIABLE dirty
- OUTPUT_STRIP_TRAILING_WHITESPACE
- WORKING_DIRECTORY ${CMake_SOURCE_DIR}
- )
- if(dirty)
- set(CMake_VERSION_IS_DIRTY 1)
- endif()
- endif()
- endif()
-endif()