From a40e6361ba7172e0a3f3b16e2d286db9928e94e2 Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 26 Jan 2023 17:28:42 +0100 Subject: 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. --- cmake/modules/GitRevParse.cmake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 cmake/modules/GitRevParse.cmake (limited to 'cmake/modules') 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() -- cgit v1.1