1
1
find_package (Threads )
2
2
3
+ # read Git revision ID
4
+ # WARNING: this value will be stored in the CMake cache
5
+ # to update it, you will have to reset the CMake cache
6
+ # (doesn't matter for CI builds like Travis for instance, where there's no permanent CMake cache)
7
+ execute_process (
8
+ COMMAND git rev-parse --short HEAD
9
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
10
+ OUTPUT_VARIABLE GIT_COMMIT
11
+ OUTPUT_STRIP_TRAILING_WHITESPACE
12
+ )
13
+
14
+ # set version and build number
15
+ set (VERSION 1-alpha )
16
+ if (DEFINED ENV{GITHUB_RUN_NUMBER} )
17
+ set (BUILD_NUMBER "GitHub actions build $ENV{GITHUB_RUN_NUMBER} " )
18
+ else ()
19
+ set (BUILD_NUMBER "<local dev build>" )
20
+ endif ()
21
+
22
+ # get current date
23
+ execute_process (
24
+ COMMAND env LC_ALL=C date -u "+%Y-%m-%d %H:%M:%S %Z"
25
+ OUTPUT_VARIABLE DATE
26
+ OUTPUT_STRIP_TRAILING_WHITESPACE
27
+ )
28
+
3
29
# TODO: CMake <= 3.7 (at least!) doesn't allow for using OBJECT libraries with target_link_libraries
4
30
add_library (linuxdeploy-plugin-qt_util STATIC util.cpp util.h )
5
31
target_include_directories (linuxdeploy-plugin-qt_util PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} )
@@ -8,6 +34,12 @@ target_link_libraries(linuxdeploy-plugin-qt_util linuxdeploy_core args Threads::
8
34
add_executable (linuxdeploy-plugin-qt main.cpp qt-modules.h qml.cpp qml.h deployment.h )
9
35
target_link_libraries (linuxdeploy-plugin-qt linuxdeploy_core args nlohmann_json::nlohmann_json linuxdeploy-plugin-qt_util Threads::Threads )
10
36
set_target_properties (linuxdeploy-plugin-qt PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR} /bin" )
37
+ target_compile_definitions (linuxdeploy-plugin-qt
38
+ PRIVATE -DLD_GIT_COMMIT= "${GIT_COMMIT} "
39
+ PRIVATE -DLD_VERSION= "${VERSION} "
40
+ PRIVATE -DLD_BUILD_NUMBER= "${BUILD_NUMBER} "
41
+ PRIVATE -DLD_BUILD_DATE= "${DATE} "
42
+ )
11
43
12
44
if (STATIC_BUILD )
13
45
message (WARNING "static builds enabled" )
0 commit comments