File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -14,11 +14,17 @@ set(CLIGHT_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/clight"
14
14
CACHE PATH "Path for data dir folder" )
15
15
16
16
execute_process (
17
- COMMAND git log -1 --format=%h
17
+ COMMAND sh -c "test -d . git && git log -1 --format=%h"
18
18
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
19
19
OUTPUT_VARIABLE GIT_HASH
20
20
OUTPUT_STRIP_TRAILING_WHITESPACE
21
21
)
22
+
23
+ if (GIT_HASH)
24
+ set (VERSION "${PROJECT_VERSION} -${GIT_HASH} " )
25
+ else ()
26
+ set (VERSION "${PROJECT_VERSION} " )
27
+ endif ()
22
28
23
29
# Create program target
24
30
file (GLOB_RECURSE SOURCES src/*.c)
@@ -33,7 +39,7 @@ target_include_directories(${PROJECT_NAME} PRIVATE
33
39
)
34
40
target_compile_definitions (${PROJECT_NAME} PRIVATE
35
41
-D_GNU_SOURCE
36
- -DVERSION="${PROJECT_VERSION} - ${GIT_HASH } "
42
+ -DVERSION="${VERSION } "
37
43
-DCONFDIR="${CLIGHT_CONFDIR} "
38
44
-DOLDCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR} /default"
39
45
-DDATADIR="${CLIGHT_DATADIR} "
You can’t perform that action at this time.
0 commit comments