-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
148 lines (117 loc) · 3.44 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
CMAKE_MINIMUM_REQUIRED(VERSION 3.5.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()
PROJECT(AusweisApp2 VERSION 1.16.2 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(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/dist" CACHE PATH "default install path" FORCE)
ENDIF()
SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
OPTION(BUILD_SHARED_LIBS "Enable build of shared libraries")
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-2019 ${VENDOR}")
STRING(REPLACE " \& " " \& " COPYRIGHT_TEXT ${COPYRIGHT_TEXT})
INCLUDE(Tools)
INCLUDE(DVCS)
ADD_SUBDIRECTORY(docs)
INCLUDE(DefaultFiles)
INCLUDE(Appcast)
INCLUDE(Messages)
IF(tools.only)
INCLUDE(Packaging)
RETURN()
ENDIF()
INCLUDE(Libraries)
INCLUDE(CompilerFlags)
ADD_SUBDIRECTORY(resources)
ADD_SUBDIRECTORY(src)
IF("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
INCLUDE(CTest)
CONFIGURE_FILE("${CMAKE_MODULE_PATH}/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()
IF(BUILD_TESTING)
ADD_SUBDIRECTORY(test)
ENDIF()
IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/utils")
ADD_SUBDIRECTORY(utils)
ENDIF()
INCLUDE(Packaging)