summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorManuel Bentele2020-10-20 08:19:13 +0200
committerManuel Bentele2020-10-20 08:21:24 +0200
commit63a5d91731295c8f2460d1af1d321ead0e7da7c0 (patch)
tree3efc568330ffc00c207f9bffdbc69974ec33c571 /cmake
parent[BUILD] set build type and stop Release build if repository is dirty (diff)
downloaddnbd3-63a5d91731295c8f2460d1af1d321ead0e7da7c0.tar.gz
dnbd3-63a5d91731295c8f2460d1af1d321ead0e7da7c0.tar.xz
dnbd3-63a5d91731295c8f2460d1af1d321ead0e7da7c0.zip
[BUILD] do not stop Release build if repository is dirty but warn
Diffstat (limited to 'cmake')
-rw-r--r--cmake/GenerateVersion.cmake13
1 files changed, 9 insertions, 4 deletions
diff --git a/cmake/GenerateVersion.cmake b/cmake/GenerateVersion.cmake
index 152ab11..4dfdaa8 100644
--- a/cmake/GenerateVersion.cmake
+++ b/cmake/GenerateVersion.cmake
@@ -16,11 +16,16 @@ execute_process(COMMAND git status --porcelain
OUTPUT_VARIABLE DNBD3_GIT_STATUS
OUTPUT_STRIP_TRAILING_WHITESPACE)
-if(VERSION_BUILD_TYPE MATCHES "Release" AND NOT DNBD3_GIT_STATUS STREQUAL "")
- message(FATAL_ERROR "This dnbd3 Git repository is dirty! Please commit or revert all changes for the ${VERSION_BUILD_TYPE} build!")
-else(VERSION_BUILD_TYPE MATCHES "Release" AND NOT DNBD3_GIT_STATUS STREQUAL "")
+# check if Git repository is dirty
+if(NOT DNBD3_GIT_STATUS STREQUAL "")
+ # the Git repository is dirty, thus extend the version information
set(DNBD3_BUILD_VERSION "${DNBD3_BUILD_VERSION}-modified")
-endif(VERSION_BUILD_TYPE MATCHES "Release" AND NOT DNBD3_GIT_STATUS STREQUAL "")
+
+ # print a message in Release build configuration to warn about the dirty repository
+ if(VERSION_BUILD_TYPE MATCHES "Release")
+ message(WARNING "This dnbd3 Git repository is dirty! Please commit or revert all changes for a ${VERSION_BUILD_TYPE} build!")
+ endif(VERSION_BUILD_TYPE MATCHES "Release")
+endif(NOT DNBD3_GIT_STATUS STREQUAL "")
# set current build type of the project
set(DNBD3_BUILD_TYPE ${VERSION_BUILD_TYPE})