Move cynara-tests packaging to a separate directory
[platform/core/security/cynara.git] / CMakeLists.txt
1 # Copyright (c) 2014 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      Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
17 #
18
19 ############################# Check minimum CMake version #####################
20
21 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
22 PROJECT("cynara")
23
24 ############################# cmake packages ##################################
25
26 INCLUDE(FindPkgConfig)
27
28 ############################# compiler flags ##################################
29
30 SET(CMAKE_C_FLAGS_PROFILING    "-g -O0 -pg")
31 SET(CMAKE_CXX_FLAGS_PROFILING  "-g -std=c++0x -O0 -pg -Wp,-U_FORTIFY_SOURCE")
32 SET(CMAKE_C_FLAGS_DEBUG        "-g -O0 -ggdb")
33 SET(CMAKE_CXX_FLAGS_DEBUG      "-g -std=c++0x -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
34 SET(CMAKE_C_FLAGS_RELEASE      "-g -O2")
35 SET(CMAKE_CXX_FLAGS_RELEASE    "-g -std=c++0x -O2")
36 SET(CMAKE_C_FLAGS_CCOV         "-g -O2 --coverage")
37 SET(CMAKE_CXX_FLAGS_CCOV       "-g -std=c++0x -O2 --coverage")
38
39 # If supported for the target machine, emit position-independent code,suitable
40 # for dynamic linking and avoiding any limit on the size of the global offset
41 # table. This option makes a difference on the m68k, PowerPC and SPARC.
42 ADD_DEFINITIONS("-fPIC")
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
52 IF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
53     ADD_DEFINITIONS("-DBUILD_TYPE_DEBUG")
54 ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
55
56 SET(TARGET_CYNARA "cynara")
57 SET(TARGET_LIB_CYNARA "cynara-client")
58 SET(TARGET_LIB_CYNARA_ADMIN "cynara-admin")
59 SET(TARGET_CYNARA_COMMON "cynara-commons")
60
61 ADD_SUBDIRECTORY(src)
62 ADD_SUBDIRECTORY(build)
63 ADD_SUBDIRECTORY(systemd)