summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorManuel Bentele2020-10-27 13:59:34 +0100
committerManuel Bentele2020-10-27 13:59:34 +0100
commit9ec84ae28cd04b43e82e22870d709dbb187e3338 (patch)
tree22398287249e9630043186c8247a1cb999b1484c /cmake
parent[BUILD] remove the build requirement for an unused C++ compiler (diff)
downloaddnbd3-9ec84ae28cd04b43e82e22870d709dbb187e3338.tar.gz
dnbd3-9ec84ae28cd04b43e82e22870d709dbb187e3338.tar.xz
dnbd3-9ec84ae28cd04b43e82e22870d709dbb187e3338.zip
[BUILD] fix broken version header packaging for source packages
Diffstat (limited to 'cmake')
-rw-r--r--cmake/PostVersionPackaging.cmake9
-rw-r--r--cmake/PreVersionPackaging.cmake11
2 files changed, 20 insertions, 0 deletions
diff --git a/cmake/PostVersionPackaging.cmake b/cmake/PostVersionPackaging.cmake
new file mode 100644
index 0000000..877cd12
--- /dev/null
+++ b/cmake/PostVersionPackaging.cmake
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (C) 2020 Manuel Bentele <development@manuel-bentele.de>
+#
+
+if(EXISTS ${VERSION_HEADER_INPUT_FILE})
+ # remove version.h if generated version.h is available from a Git build
+ file(REMOVE ${VERSION_HEADER_OUTPUT_FILE})
+endif(EXISTS ${VERSION_HEADER_INPUT_FILE})
diff --git a/cmake/PreVersionPackaging.cmake b/cmake/PreVersionPackaging.cmake
new file mode 100644
index 0000000..e960155
--- /dev/null
+++ b/cmake/PreVersionPackaging.cmake
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (C) 2020 Manuel Bentele <development@manuel-bentele.de>
+#
+
+if(EXISTS ${VERSION_HEADER_INPUT_FILE})
+ # copy generated version.h into the source repository for packaging purposes
+ get_filename_component(VERSION_HEADER_OUTPUT_FILE_PATH ${VERSION_HEADER_OUTPUT_FILE} PATH)
+ file(COPY ${VERSION_HEADER_INPUT_FILE}
+ DESTINATION ${VERSION_HEADER_OUTPUT_FILE_PATH})
+endif(EXISTS ${VERSION_HEADER_INPUT_FILE})