summaryrefslogtreecommitdiffstats
path: root/Source/CMakeVersion.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-07-23 20:41:29 (GMT)
committerBrad King <brad.king@kitware.com>2019-07-29 15:25:43 (GMT)
commitecdf38aa36cfcc897e585ba05fd6f6e738bb5157 (patch)
tree9bd4380d4a444b5e8303c43bfdc38debaa2db385 /Source/CMakeVersion.cmake
parent8cf4aec5acc2a3a10abbbbbde17c18d96a97e139 (diff)
downloadCMake-ecdf38aa36cfcc897e585ba05fd6f6e738bb5157.zip
CMake-ecdf38aa36cfcc897e585ba05fd6f6e738bb5157.tar.gz
CMake-ecdf38aa36cfcc897e585ba05fd6f6e738bb5157.tar.bz2
CMakeVersion: Move computation logic to main script
Diffstat (limited to 'Source/CMakeVersion.cmake')
-rw-r--r--Source/CMakeVersion.cmake27
1 files changed, 27 insertions, 0 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index ea3b43a..08d3169 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -3,3 +3,30 @@ set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 15)
set(CMake_VERSION_PATCH 20190726)
#set(CMake_VERSION_RC 0)
+
+# Releases define a small patch level.
+if("${CMake_VERSION_PATCH}" VERSION_LESS 20000000)
+ set(CMake_VERSION_IS_DIRTY 0)
+ 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_RELEASE 0)
+ include(${CMake_SOURCE_DIR}/Source/CMakeVersionSource.cmake)
+endif()
+
+# Compute the full version string.
+set(CMake_VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH})
+if(CMake_VERSION_SOURCE)
+ set(CMake_VERSION_SUFFIX "${CMake_VERSION_SOURCE}")
+elseif(DEFINED CMake_VERSION_RC)
+ set(CMake_VERSION_SUFFIX "rc${CMake_VERSION_RC}")
+else()
+ set(CMake_VERSION_SUFFIX "")
+endif()
+if(CMake_VERSION_SUFFIX)
+ set(CMake_VERSION ${CMake_VERSION}-${CMake_VERSION_SUFFIX})
+endif()
+if(CMake_VERSION_IS_DIRTY)
+ set(CMake_VERSION ${CMake_VERSION}-dirty)
+endif()