From 38cfdf99f4c7cdf3e81a4b32fb8ccaf522c84e73 Mon Sep 17 00:00:00 2001 From: Luminarys Date: Tue, 25 Aug 2015 22:04:57 -0500 Subject: Added in build version based on git hash --- CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 1365a9ae..fe424728 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,20 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin/") add_definitions("-Wall -Wextra -Wno-unused-parameter") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMake) +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") + execute_process( + COMMAND git log -1 --format=%h + OUTPUT_VARIABLE GIT_COMMIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +else(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") + set(GIT_COMMIT_HASH "Not Found") +endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") + +SET(GIT_VERSION_FLAG "-DSWAY_GIT_VERSION=\"${GIT_COMMIT_HASH}\"") + +add_definitions("${GIT_VERSION_FLAG}") + find_package(XKBCommon REQUIRED) find_package(WLC REQUIRED) find_package(A2X REQUIRED) -- cgit v1.2.3 From 429fc53e51bdbdbfc23894993f6ae170ff518fb6 Mon Sep 17 00:00:00 2001 From: Luminarys Date: Wed, 26 Aug 2015 09:14:32 -0500 Subject: Minor fixes --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index fe424728..3e639e1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,12 +7,10 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMake) if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") execute_process( - COMMAND git log -1 --format=%h + COMMAND git describe --always OUTPUT_VARIABLE GIT_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE ) -else(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") - set(GIT_COMMIT_HASH "Not Found") endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") SET(GIT_VERSION_FLAG "-DSWAY_GIT_VERSION=\"${GIT_COMMIT_HASH}\"") -- cgit v1.2.3