summaryrefslogtreecommitdiff
path: root/qmap/getsvn.cmake
diff options
context:
space:
mode:
authortony mancill <tmancill@debian.org>2023-09-03 19:46:43 -0700
committertony mancill <tmancill@debian.org>2023-09-03 19:46:43 -0700
commit393a486ee1d7e308a49f8e0b8c3a4b2f43223248 (patch)
tree6a6e8a56ace360795e1cf1a310d5652bb23f1386 /qmap/getsvn.cmake
parent6a285ab382ebff18c88e52bec75dc1773ac33b74 (diff)
New upstream version 2.7.0~rc2+repackupstream/2.7.0_rc2+repack
Diffstat (limited to 'qmap/getsvn.cmake')
-rwxr-xr-xqmap/getsvn.cmake16
1 files changed, 16 insertions, 0 deletions
diff --git a/qmap/getsvn.cmake b/qmap/getsvn.cmake
new file mode 100755
index 00000000..a71b589a
--- /dev/null
+++ b/qmap/getsvn.cmake
@@ -0,0 +1,16 @@
+find_package (Subversion)
+if (Subversion_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.svn)
+ # the FindSubversion.cmake module is part of the standard distribution
+ include (FindSubversion)
+ # extract working copy information for SOURCE_DIR into MY_XXX variables
+ Subversion_WC_INFO (${SOURCE_DIR} MY)
+ # write a file with the SVNVERSION define
+ file (WRITE svnversion.h.txt "#define SVNVERSION ${MY_WC_REVISION}\n")
+else (Subversion_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.svn)
+ file (WRITE svnversion.h.txt "#define SVNVERSION local\n")
+endif (Subversion_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.svn)
+
+# copy the file to the final header only if the version changes
+# reduces needless rebuilds
+execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ svnversion.h.txt svnversion.h)