aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt14
-rw-r--r--sway/main.c6
2 files changed, 19 insertions, 1 deletions
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/")
5add_definitions("-Wall -Wextra -Wno-unused-parameter") 5add_definitions("-Wall -Wextra -Wno-unused-parameter")
6set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMake) 6set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMake)
7 7
8if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
9 execute_process(
10 COMMAND git log -1 --format=%h
11 OUTPUT_VARIABLE GIT_COMMIT_HASH
12 OUTPUT_STRIP_TRAILING_WHITESPACE
13 )
14else(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
15 set(GIT_COMMIT_HASH "Not Found")
16endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
17
18SET(GIT_VERSION_FLAG "-DSWAY_GIT_VERSION=\"${GIT_COMMIT_HASH}\"")
19
20add_definitions("${GIT_VERSION_FLAG}")
21
8find_package(XKBCommon REQUIRED) 22find_package(XKBCommon REQUIRED)
9find_package(WLC REQUIRED) 23find_package(WLC REQUIRED)
10find_package(A2X REQUIRED) 24find_package(A2X REQUIRED)
diff --git a/sway/main.c b/sway/main.c
index afbdab33..0880cb8c 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -78,7 +78,11 @@ int main(int argc, char **argv) {
78 debug = 1; 78 debug = 1;
79 break; 79 break;
80 case 'v': // version 80 case 'v': // version
81 // todo 81#ifdef SWAY_GIT_VERSION
82 fprintf(stdout, "sway build %s\n", SWAY_GIT_VERSION);
83#else
84 fprintf(stdout, "version not detected\n");
85#endif
82 exit(0); 86 exit(0);
83 break; 87 break;
84 case 'V': // verbose 88 case 'V': // verbose