forked from Akaflieg-Freiburg/enroute
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
119 lines (93 loc) · 2.62 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#
# Set up cmake
#
cmake_minimum_required(VERSION 3.16)
include(ExternalProject)
option(BUILD_DOC "Build developer documentation" OFF)
#
# Project data
#
project(enroute VERSION 2.12.7)
set(APP_ID de.akaflieg_freiburg.enroute)
math(EXPR PROJECT_VERSION_CODE 10000*${PROJECT_VERSION_MAJOR}+100*${PROJECT_VERSION_MINOR}+${PROJECT_VERSION_PATCH})
add_compile_definitions(PROJECT_VERSION="${PROJECT_VERSION}")
#
# Installation
#
include(GNUInstallDirs)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#
# Qt Setup
#
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
#
# External Packages
#
find_package(Doxygen)
find_package(Git REQUIRED)
find_package(Qt5 5.15 COMPONENTS Concurrent Core Gui LinguistTools Positioning Quick QuickWidgets Sql Svg WebView REQUIRED)
if( ANDROID )
find_package(Qt5 5.15 COMPONENTS AndroidExtras REQUIRED)
find_package(Qt5QuickCompiler)
else()
find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
include(KDEInstallDirs)
find_package(KF5Notifications REQUIRED)
find_package(Qt5 5.15 COMPONENTS DBus Widgets REQUIRED)
endif()
#
# Create target collecting all documentation
#
if ( BUILD_DOC )
add_custom_target(fulldoc ALL)
else()
add_custom_target(fulldoc)
endif()
#
# Find GIT repository data.
#
if (EXISTS ${CMAKE_SOURCE_DIR}/.git)
# Get the current working branch
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("Currently working with git branch ${GIT_BRANCH}")
# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("Currently working with git Commit ${GIT_COMMIT}")
# Get the latest commit date of the working branch
execute_process(
COMMAND git log -1 --format=%as
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("Currently working with git commit from ${GIT_DATE}")
else()
message("Not working from a GIT directory")
set(GIT_BRANCH "")
set(GIT_COMMIT "")
set(GIT_DATE "")
endif()
add_compile_definitions(GIT_COMMIT="${GIT_COMMIT}")
#
# Subdirectories
#
add_subdirectory(3rdParty)
add_subdirectory(generatedSources)
add_subdirectory(metadata)
add_subdirectory(packaging)
add_subdirectory(src)