forked from Governikus/AusweisApp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
160 lines (129 loc) · 3.83 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
CMAKE_MINIMUM_REQUIRED(VERSION 3.8.0)
IF(POLICY CMP0020)
CMAKE_POLICY(SET CMP0020 NEW)
ENDIF()
IF(POLICY CMP0046)
CMAKE_POLICY(SET CMP0046 NEW)
ENDIF()
IF(POLICY CMP0048)
CMAKE_POLICY(SET CMP0048 NEW)
ENDIF()
IF(POLICY CMP0054)
CMAKE_POLICY(SET CMP0054 NEW)
ENDIF()
IF(POLICY CMP0063)
CMAKE_POLICY(SET CMP0063 NEW)
ENDIF()
IF(POLICY CMP0071)
CMAKE_POLICY(SET CMP0071 NEW)
ENDIF()
IF(POLICY CMP0074)
CMAKE_POLICY(SET CMP0074 NEW)
ENDIF()
# "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(APPLE AND NOT IOS)
SET(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Required macOS version")
ENDIF()
PROJECT(AusweisApp2 VERSION 1.20.0 LANGUAGES ${LANGUAGES})
# 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 CMAKE_VERSION VERSION_GREATER_EQUAL "3.16" AND NOT tools.only)
ENABLE_LANGUAGE(OBJCXX)
ENDIF()
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND (IOS OR ANDROID))
SET(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/dist" CACHE PATH "default install path" FORCE)
ENDIF()
SET(CMAKE_DIR "${PROJECT_SOURCE_DIR}/cmake")
SET(CMAKE_MODULE_PATH "${CMAKE_DIR}")
OPTION(BUILD_SHARED_LIBS "Enable build of shared libraries")
OPTION(INTEGRATED_SDK "Build platform specific SDK" OFF)
INCLUDE(Helper)
IF(NOT VENDOR)
SET(VENDOR_FILE "${PROJECT_SOURCE_DIR}/vendor.txt")
IF(EXISTS "${VENDOR_FILE}")
FILE(READ "${VENDOR_FILE}" VENDOR)
STRING(STRIP "${VENDOR}" VENDOR)
ELSE()
SET(VENDOR AusweisApp2_CE) # CommunityEdition
ENDIF()
ENDIF()
IF(VENDOR MATCHES "Governikus")
SET(VENDOR_GOVERNIKUS TRUE)
ENDIF()
MESSAGE(STATUS "VENDOR: ${VENDOR}")
MESSAGE(STATUS "VERSION: ${PROJECT_VERSION}")
IF(ANDROID)
GET_ANDROID_TOOLCHAIN_VARS(ANDROID_TOOLCHAIN_PREFIX ANDROID_TOOLCHAIN_MACHINE_NAME)
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)
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()
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()
IF(DESKTOP)
SET(CMAKE_AUTOUIC ON)
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(RESOURCES_DIR ${PROJECT_SOURCE_DIR}/resources)
SET(PACKAGING_DIR ${RESOURCES_DIR}/packaging)
SET(COPYRIGHT_TEXT "2014-2020 ${VENDOR}")
IF(APPLE)
STRING(REPLACE " \& " " \& " COPYRIGHT_TEXT ${COPYRIGHT_TEXT})
ENDIF()
SET(BUNDLE_IDENTIFIER com.governikus.ausweisapp2)
INCLUDE(Tools)
INCLUDE(DVCS)
ADD_SUBDIRECTORY(docs)
INCLUDE(DefaultFiles)
INCLUDE(Appcast)
INCLUDE(Messages)
IF(tools.only)
INCLUDE(Packaging)
RETURN()
ENDIF()
IF("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
INCLUDE(CTest)
CONFIGURE_FILE("${CMAKE_DIR}/CTestCustom.cmake.in" "${CMAKE_BINARY_DIR}/CTestCustom.cmake" @ONLY)
CONFIGURE_FILE("${RESOURCES_DIR}/sonar-project.properties.in" "${CMAKE_BINARY_DIR}/sonar-project.properties" @ONLY)
ENDIF()
INCLUDE(Libraries)
INCLUDE(CompilerFlags)
IF(LINUX OR BSD)
INCLUDE(GNUInstallDirs)
ENDIF()
ADD_SUBDIRECTORY(resources)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(test)
IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/utils")
ADD_SUBDIRECTORY(utils)
ENDIF()
INCLUDE(Packaging)