forked from Governikus/AusweisApp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
175 lines (140 loc) · 4.65 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
cmake_minimum_required(VERSION 3.19.0)
set(CMAKE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(CMAKE_MODULE_PATH "${CMAKE_DIR}")
include(Policies)
# "tools.only" can be defined to disable the normal build and enable
# cmdline "tools" only. For example: "make format" or "make package_source"
if(tools.only)
set(LANGUAGES NONE)
else()
set(LANGUAGES CXX)
endif()
if(UNIX AND NOT IOS)
set(CMAKE_OSX_DEPLOYMENT_TARGET 12.0 CACHE STRING "Required macOS version")
endif()
if(CMAKE_BUILD_TYPE)
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
else()
set(CMAKE_BUILD_TYPE "DEBUG" CACHE STRING "build type configuration" FORCE)
endif()
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(isMultiConfig)
if(NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
endif()
list(LENGTH CMAKE_CONFIGURATION_TYPES multiConfigCount)
if(NOT multiConfigCount EQUAL 1)
message(FATAL_ERROR "Multi-Config builds are not supported: QTBUG-123340")
endif()
endif()
project(AusweisApp VERSION 2.2.2 LANGUAGES ${LANGUAGES})
if(ANDROID AND NOT GOVERNIKUS_TOOLCHAIN_FILE)
message(FATAL_ERROR "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_DIR}/android.toolchain.cmake is required")
endif()
# Set TWEAK if not defined in PROJECT_VERSION above to
# have a valid tweak version without propagating it
if(NOT PROJECT_VERSION_TWEAK)
set(PROJECT_VERSION_TWEAK 0)
endif()
if(APPLE AND NOT tools.only)
enable_language(OBJCXX)
endif()
option(BUILD_SHARED_LIBS "Enable build of shared libraries")
option(INTEGRATED_SDK "Build platform specific SDK" OFF)
option(CONTAINER_SDK "Build container specific SDK" OFF)
if(CONTAINER_SDK)
set(INTEGRATED_SDK ON)
endif()
include(Helper)
if(NOT VENDOR)
if(EXISTS "${CMAKE_DIR}/Vendor.internal.cmake")
include(Vendor.internal)
else()
set(VENDOR "") # Qt uses Organization for paths
endif()
endif()
if(VENDOR MATCHES "Governikus")
set(VENDOR_GOVERNIKUS TRUE)
set(LICENSE_FILE "${PROJECT_SOURCE_DIR}/LICENSE.officially.txt")
else()
set(LICENSE_FILE "${PROJECT_SOURCE_DIR}/LICENSE.txt")
endif()
message(STATUS "VENDOR: ${VENDOR}")
message(STATUS "VERSION: ${PROJECT_VERSION}")
if(ANDROID)
if(NOT BUILD_PREVIEW)
set(BUILD_PREVIEW false)
endif()
message(STATUS "BUILD_PREVIEW: ${BUILD_PREVIEW}")
if(NOT ANDROID_VERSION_CODE)
set(ANDROID_VERSION_CODE 0)
endif()
message(STATUS "ANDROID_VERSION_CODE: ${ANDROID_VERSION_CODE}")
endif()
if(IOS OR MAC)
if(NOT USE_DISTRIBUTION_PROFILE)
set(USE_DISTRIBUTION_PROFILE false)
endif()
message(STATUS "USE_DISTRIBUTION_PROFILE: ${USE_DISTRIBUTION_PROFILE}")
endif()
if("${PROJECT_BINARY_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}" AND NOT FORCE_SOURCE_BUILD)
message(FATAL_ERROR "in tree building is not supported!")
endif()
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(SRC_DIR ${PROJECT_SOURCE_DIR}/src)
set(TEST_DIR ${PROJECT_SOURCE_DIR}/test)
set(DOCS_DIR ${PROJECT_SOURCE_DIR}/docs)
set(RESOURCES_DIR ${PROJECT_SOURCE_DIR}/resources)
set(PACKAGING_DIR ${RESOURCES_DIR}/packaging)
set(COPYRIGHT_TEXT "2014-2024 ${VENDOR}")
if(APPLE)
string(REPLACE " \& " " \& " COPYRIGHT_TEXT ${COPYRIGHT_TEXT})
endif()
set(BUNDLE_IDENTIFIER com.governikus.ausweisapp2)
if(NOT CONTAINER_SDK)
include(CTest)
endif()
include(Tools)
include(DVCS)
add_subdirectory(docs)
include(Appcast)
include(Messages)
if(tools.only)
include(Packaging)
return()
endif()
option(USE_SMARTEID "Enable Smart-eID" OFF)
include(Libraries)
include(PoliciesQt)
include(Tools.Libraries)
include(CompilerFlags)
if(LINUX OR BSD)
include(GNUInstallDirs)
endif()
add_subdirectory(resources)
add_subdirectory(src)
if(BUILD_TESTING)
add_subdirectory(test)
endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/utils")
add_subdirectory(utils)
endif()
include(Packaging)
if(BUILD_TESTING)
set(VALGRIND_SUPPRESSIONS "${CMAKE_PREFIX_PATH}/test/valgrind.supp")
if(NOT EXISTS "${VALGRIND_SUPPRESSIONS}")
set(VALGRIND_SUPPRESSIONS "${CMAKE_SOURCE_DIR}/libs/test/valgrind.supp")
endif()
message(STATUS "Using valgrind suppressions: ${VALGRIND_SUPPRESSIONS}")
set(VALGRIND_COMMAND_OPTIONS "--tool=memcheck --leak-check=full --show-leak-kinds=definite --errors-for-leak-kinds=definite --error-exitcode=1 --gen-suppressions=all --suppressions=${VALGRIND_SUPPRESSIONS}")
configure_file("${CMAKE_DIR}/CTestCustom.cmake.in" "${CMAKE_BINARY_DIR}/CTestCustom.cmake" @ONLY)
set(SONAR_CACHE_DIR ${CMAKE_BINARY_DIR}/../cache)
if(NOT EXISTS "${SONAR_CACHE_DIR}")
set(SONAR_CACHE_DIR ${CMAKE_BINARY_DIR})
endif()
get_filename_component(SONAR_CACHE_DIR ${SONAR_CACHE_DIR} ABSOLUTE)
configure_file("${RESOURCES_DIR}/sonar-project.properties.in" "${CMAKE_BINARY_DIR}/sonar-project.properties" @ONLY)
endif()
include(FeatureSummary)
FEATURE_SUMMARY(WHAT ALL)