From 6a077b5d63895489c2962af2f7302f52444045cc Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 1 Jul 2016 09:40:09 +0200 Subject: Make CMake version suffix available to code Make the string (e.g. "rc1" or "gSHA-dirty") available to the code. --- Source/CMakeVersionCompute.cmake | 12 ++++++++---- Source/cmVersionConfig.h.in | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Source/CMakeVersionCompute.cmake b/Source/CMakeVersionCompute.cmake index 496d6cf..806e987 100644 --- a/Source/CMakeVersionCompute.cmake +++ b/Source/CMakeVersionCompute.cmake @@ -12,9 +12,13 @@ endif() # Compute the full version string. set(CMake_VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}) -if(CMake_VERSION_RC) - set(CMake_VERSION ${CMake_VERSION}-rc${CMake_VERSION_RC}) -endif() if(CMake_VERSION_SOURCE) - set(CMake_VERSION ${CMake_VERSION}-${CMake_VERSION_SOURCE}) + set(CMake_VERSION_SUFFIX "${CMake_VERSION_SOURCE}") +elseif(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() diff --git a/Source/cmVersionConfig.h.in b/Source/cmVersionConfig.h.in index 16aeabe..af5c57b 100644 --- a/Source/cmVersionConfig.h.in +++ b/Source/cmVersionConfig.h.in @@ -12,4 +12,5 @@ #define CMake_VERSION_MAJOR @CMake_VERSION_MAJOR@ #define CMake_VERSION_MINOR @CMake_VERSION_MINOR@ #define CMake_VERSION_PATCH @CMake_VERSION_PATCH@ +#define CMake_VERSION_SUFFIX "@CMake_VERSION_SUFFIX@" #define CMake_VERSION "@CMake_VERSION@" -- cgit v0.12