Revert "add the se-backend for db encryption"
[platform/core/security/key-manager.git] / CMakeLists.txt
1 # Copyright (c) 2011-2020 Samsung Electronics Co., Ltd. All rights reserved
2 #
3 #    Licensed under the Apache License, Version 2.0 (the "License");
4 #    you may not use this file except in compliance with the License.
5 #    You may obtain a copy of the License at
6 #
7 #        http://www.apache.org/licenses/LICENSE-2.0
8 #
9 #    Unless required by applicable law or agreed to in writing, software
10 #    distributed under the License is distributed on an "AS IS" BASIS,
11 #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 #    See the License for the specific language governing permissions and
13 #    limitations under the License.
14 #
15 # @file        CMakeLists.txt
16 # @author
17 # @brief
18 #
19
20 ############################# Check minimum CMake version #####################
21
22 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
23 PROJECT("key-manager")
24
25 ############################# cmake packages ##################################
26
27 INCLUDE(FindPkgConfig)
28
29 ############################# compiler flags ##################################
30
31 SET(CMAKE_C_FLAGS_PROFILING    "-g -O0 -pg -Wp,-U_FORTIFY_SOURCE")
32 SET(CMAKE_CXX_FLAGS_PROFILING  "-g -std=c++14 -O0 -pg -Wp,-U_FORTIFY_SOURCE")
33 SET(CMAKE_C_FLAGS_DEBUG        "-g -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
34 SET(CMAKE_CXX_FLAGS_DEBUG      "-g -std=c++14 -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
35 SET(CMAKE_C_FLAGS_RELEASE      "-g -O2")
36 SET(CMAKE_CXX_FLAGS_RELEASE    "-g -std=c++14 -O2")
37 SET(CMAKE_C_FLAGS_CCOV         "-g -O2 --coverage")
38 SET(CMAKE_CXX_FLAGS_CCOV       "-g -std=c++14 -O2 --coverage")
39
40 # Force PIE
41 SET(CMAKE_POSITION_INDEPENDENT_CODE "True")
42 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
43
44 # Set compiler warning flags
45 ADD_DEFINITIONS("-Werror")                      # Make all warnings into errors.
46 ADD_DEFINITIONS("-Wall")                        # Generate all warnings
47 ADD_DEFINITIONS("-Wextra")                      # Generate even more extra warnings
48
49 STRING(REGEX MATCH "([^.]*)" API_VERSION "${VERSION}")
50 ADD_DEFINITIONS("-DAPI_VERSION=\"$(API_VERSION)\"")
51 ADD_DEFINITIONS("-DSMACK_ENABLED")
52 ADD_DEFINITIONS("-DSQLITE_HAS_CODEC")
53 ADD_DEFINITIONS("-DDUMP_LEGACY_DB_LIBNAME=\"${DUMP_LEGACY_DB_LIBNAME}\"")
54 ADD_DEFINITIONS("-DLIB_INSTALL_DIR=\"${LIB_INSTALL_DIR}\"")
55 ADD_DEFINITIONS("-DRUN_DIR=\"${RUN_DIR}\"")
56 ADD_DEFINITIONS("-DSERVICE_NAME=\"${SERVICE_NAME}\"")
57 ADD_DEFINITIONS("-DUSER_NAME=\"${USER_NAME}\"")
58 ADD_DEFINITIONS("-DGROUP_NAME=\"${GROUP_NAME}\"")
59 ADD_DEFINITIONS("-DSMACK_DOMAIN_NAME=\"${SMACK_DOMAIN_NAME}\"")
60 ADD_DEFINITIONS("-DOLD_RW_DATA_DIR=\"${OLD_RW_DATA_DIR}\"")
61 ADD_DEFINITIONS("-DRW_DATA_DIR=\"${RW_DATA_DIR}\"")
62 ADD_DEFINITIONS("-DRO_DATA_DIR=\"${RO_DATA_DIR}\"")
63 ADD_DEFINITIONS("-DETC_DIR=\"${ETC_DIR}\"")
64 ADD_DEFINITIONS("-DBIN_DIR=\"${BIN_DIR}\"")
65 ADD_DEFINITIONS("-DINITIAL_VALUES_DIR_RO=\"${INITIAL_VALUES_DIR_RO}\"")
66 ADD_DEFINITIONS("-DINITIAL_VALUES_DIR_RW=\"${INITIAL_VALUES_DIR_RW}\"")
67 ADD_DEFINITIONS("-DCA_CERTS_DIR=\"${CA_CERTS_DIR}\"")
68 ADD_DEFINITIONS("-DSYSTEMD_ENV_FILE=\"${SYSTEMD_ENV_FILE}\"")
69
70 IF (TZ_BACKEND_ENABLED)
71     ADD_DEFINITIONS("-DTZ_BACKEND_ENABLED")
72 ENDIF()
73
74 IF (DEFINED WATCHDOG_ENABLED)
75     MESSAGE("WATCHDOG ENABELD!")
76     ADD_DEFINITIONS("-DWATCHDOG_ENABLED")
77     ADD_DEFINITIONS("-DWATCHDOG_TIMEOUT_SEC=${WATCHDOG_TIMEOUT_SEC}")
78     ADD_DEFINITIONS("-DWATCHDOG_NOTIFY_SEC=${WATCHDOG_NOTIFY_SEC}")
79     SET(WATCHDOG_DECLARE "NotifyAccess=main")
80 ENDIF (DEFINED WATCHDOG_ENABLED)
81
82 IF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
83     ADD_DEFINITIONS("-DTIZEN_DEBUG_ENABLE")
84     ADD_DEFINITIONS("-DBUILD_TYPE_DEBUG")
85 ELSE (CMAKE_BUILD_TYPE MATCHES "DEBUG")
86     ADD_DEFINITIONS("-DNDEBUG=1")
87 ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
88
89 SET(TARGET_KEY_MANAGER "key-manager")
90 SET(TARGET_KEY_MANAGER_CLIENT "key-manager-client")
91 SET(TARGET_KEY_MANAGER_CONTROL_CLIENT "key-manager-control-client")
92 SET(TARGET_KEY_MANAGER_COMMON "key-manager-common")
93 SET(TARGET_PAM_KEY_MANAGER_PLUGIN "pam_key_manager_plugin")
94
95 SET(TARGET_TEST_MERGED "ckm-tests-internal")
96
97 CONFIGURE_FILE(packaging/key-manager.manifest.in key-manager.manifest @ONLY)
98 CONFIGURE_FILE(packaging/key-manager-tests.manifest.in key-manager-tests.manifest @ONLY)
99
100 ADD_SUBDIRECTORY(data)
101 ADD_SUBDIRECTORY(doc)
102 ADD_SUBDIRECTORY(src)
103 ADD_SUBDIRECTORY(build)
104 ADD_SUBDIRECTORY(systemd)
105 ADD_SUBDIRECTORY(tests)
106 ADD_SUBDIRECTORY(tools)
107 ADD_SUBDIRECTORY(upgrade)