summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
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})