summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2023-01-26 17:28:42 +0100
committerAki <please@ignore.pl>2023-01-26 17:31:38 +0100
commita40e6361ba7172e0a3f3b16e2d286db9928e94e2 (patch)
tree6e9d32a8a3e87fcedfb963f77f5c97d365fab437 /cmake
parent0df01f74aac44831c7a8e181625058d2db6b8133 (diff)
downloadkurator-a40e6361ba7172e0a3f3b16e2d286db9928e94e2.zip
kurator-a40e6361ba7172e0a3f3b16e2d286db9928e94e2.tar.gz
kurator-a40e6361ba7172e0a3f3b16e2d286db9928e94e2.tar.bz2
Added build version identification to title screen
Since this uses configure_file it might have problems sometimes when trying to detect updated value. It will be better to move it to use custom target instead.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/GitRevParse.cmake14
1 files changed, 14 insertions, 0 deletions
diff --git a/cmake/modules/GitRevParse.cmake b/cmake/modules/GitRevParse.cmake
new file mode 100644
index 0000000..9005d65
--- /dev/null
+++ b/cmake/modules/GitRevParse.cmake
@@ -0,0 +1,14 @@
+function(git_rev_parse VAR)
+ execute_process(
+ COMMAND git rev-parse --short HEAD
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ RESULT_VARIABLE PARSE_RESULT
+ OUTPUT_VARIABLE PARSE_OUTPUT
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if(NOT PARSE_RESULT)
+ set(${VAR} ${PARSE_OUTPUT} PARENT_SCOPE)
+ else()
+ set(${VAR} "Unknown" PARENT_SCOPE)
+ endif()
+endfunction()