Extract storage code into libcynara-storage
[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 # @author      Radoslaw Bartosiak <r.bartosiak@samsung.com>
18 #
19
20 ############################# Check minimum CMake version #####################
21
22 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
23 PROJECT("cynara")
24 set(CYNARA_VERSION 0.2.2)
25
26 ############################# cmake packages ##################################
27
28 INCLUDE(FindPkgConfig)
29 INCLUDE(CheckCXXCompilerFlag)
30
31 #############################  install dirs  ##################################
32
33 SET(LIB_INSTALL_DIR
34     "${CMAKE_INSTALL_PREFIX}/lib"
35     CACHE PATH
36     "Library installation directory")
37
38 SET(BIN_INSTALL_DIR
39     "${CMAKE_INSTALL_PREFIX}/bin"
40     CACHE PATH
41     "Binary installation directory")
42
43 SET(INCLUDE_INSTALL_DIR
44     "${CMAKE_INSTALL_PREFIX}/include"
45     CACHE PATH
46     "Include installation directory")
47
48 ############################# compiler flags ##################################
49
50 SET(CMAKE_CXX_FLAGS_PROFILING  "-O0 -g -pg")
51 SET(CMAKE_CXX_FLAGS_DEBUG      "-O0 -g -ggdb")
52 SET(CMAKE_CXX_FLAGS_RELEASE    "-O2 -g")
53 SET(CMAKE_CXX_FLAGS_CCOV       "-O2 -g --coverage")
54
55 # Check for C++11 support and enable proper compilation flags
56 CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
57 CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
58 IF(COMPILER_SUPPORTS_CXX11)
59     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
60 ELSEIF(COMPILER_SUPPORTS_CXX0X)
61     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
62 ELSE()
63     MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
64 ENDIF()
65
66 # Set compiler warning flags
67 ADD_DEFINITIONS("-Werror")                      # Make all warnings into errors.
68 ADD_DEFINITIONS("-Wall")                        # Generate all warnings
69 ADD_DEFINITIONS("-Wextra")                      # Generate even more extra warnings
70
71 # Don't export symbols by default
72 ADD_DEFINITIONS("-fvisibility=hidden")
73
74
75 IF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
76     ADD_DEFINITIONS("-DBUILD_TYPE_DEBUG")
77 ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
78
79 SET(TARGET_CYNARA "cynara")
80 SET(TARGET_LIB_CYNARA "cynara-client")
81 SET(TARGET_LIB_CYNARA_COMMON "cynara-client-commons")
82 SET(TARGET_LIB_CYNARA_ADMIN "cynara-admin")
83 SET(TARGET_CYNARA_COMMON "cynara-commons")
84 SET(TARGET_CYNARA_TESTS "cynara-tests")
85 SET(TARGET_LIB_CREDS_COMMONS "cynara-creds-commons")
86 SET(TARGET_LIB_CREDS_DBUS "cynara-creds-dbus")
87 SET(TARGET_LIB_CREDS_SOCKET "cynara-creds-socket")
88 SET(TARGET_LIB_SESSION "cynara-session")
89 SET(TARGET_LIB_CYNARA_STORAGE "cynara-storage")
90
91 ADD_SUBDIRECTORY(src)
92 ADD_SUBDIRECTORY(pkgconfig)
93 ADD_SUBDIRECTORY(systemd)
94
95 IF (BUILD_TESTS)
96 ADD_SUBDIRECTORY(test)
97 ENDIF()