Update implementation of Stringify.
[platform/core/security/key-manager.git] / CMakeLists.txt
1 # Copyright (c) 2011 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++0x -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++0x -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
35 SET(CMAKE_C_FLAGS_RELEASE      "-g -O2")
36 SET(CMAKE_CXX_FLAGS_RELEASE    "-g -std=c++0x -O2")
37 SET(CMAKE_C_FLAGS_CCOV         "-g -O2 --coverage")
38 SET(CMAKE_CXX_FLAGS_CCOV       "-g -std=c++0x -O2 --coverage")
39
40 # If supported for the target machine, emit position-independent code,suitable
41 # for dynamic linking and avoiding any limit on the size of the global offset
42 # table. This option makes a difference on the m68k, PowerPC and SPARC.
43 # (BJ: our ARM too?)
44 ADD_DEFINITIONS("-fPIC")
45
46 # Set compiler warning flags
47 ADD_DEFINITIONS("-Werror")                      # Make all warnings into errors.
48 ADD_DEFINITIONS("-Wall")                        # Generate all warnings
49 ADD_DEFINITIONS("-Wextra")                      # Generate even more extra warnings
50
51 STRING(REGEX MATCH "([^.]*)" API_VERSION "${VERSION}")
52 ADD_DEFINITIONS("-DAPI_VERSION=\"$(API_VERSION)\"")
53 ADD_DEFINITIONS("-DSMACK_ENABLED")
54 ADD_DEFINITIONS("-DSQLCIPHER_HAS_CODEC")
55
56 IF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
57     ADD_DEFINITIONS("-DTIZEN_DEBUG_ENABLE")
58     ADD_DEFINITIONS("-DBUILD_TYPE_DEBUG")
59 ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
60
61 IF (DEFINED SECURITY_MDFPP_STATE_ENABLE)
62     MESSAGE("SECURITY_MDFPP_STATE_ENABLE ENABLED !")
63     ADD_DEFINITIONS("-DSECURITY_MDFPP_STATE_ENABLE")
64 ELSE (DEFINED SECURITY_MDFPP_STATE_ENABLE)
65     MESSAGE("SECURITY_MDFPP_STATE_ENABLE DISABLED !")
66 ENDIF (DEFINED SECURITY_MDFPP_STATE_ENABLE)
67
68 IF (DEFINED SYSTEMD_ENV_FILE)
69     ADD_DEFINITIONS(-DSYSTEMD_ENV_FILE="${SYSTEMD_ENV_FILE}")
70 ENDIF (DEFINED SYSTEMD_ENV_FILE)
71
72 SET(TARGET_KEY_MANAGER "key-manager")
73 SET(TARGET_KEY_MANAGER_CLIENT "key-manager-client")
74 SET(TARGET_KEY_MANAGER_CONTROL_CLIENT "key-manager-control-client")
75 SET(TARGET_KEY_MANAGER_COMMON "key-manager-common")
76 SET(TARGET_LISTENER "key-manager-listener")
77 SET(TARGET_PAM_KEY_MANAGER_PLUGIN "pam_key_manager_plugin")
78
79 SET(TARGET_TEST_MERGED "ckm-tests-internal")
80
81 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/data/scripts/230.key-manager-migrate-dkek.patch.sh
82     DESTINATION /etc/opt/upgrade
83     PERMISSIONS OWNER_READ
84                 OWNER_WRITE
85                 OWNER_EXECUTE)
86
87 ADD_SUBDIRECTORY(src)
88 ADD_SUBDIRECTORY(build)
89 ADD_SUBDIRECTORY(systemd)
90 ADD_SUBDIRECTORY(tests)
91 ADD_SUBDIRECTORY(tools)