Release 0.5.0
[platform/core/security/cynara.git] / CMakeLists.txt
1 # Copyright (c) 2014-2015 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.5.0)
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(SBIN_INSTALL_DIR
44     "${CMAKE_INSTALL_PREFIX}/sbin"
45     CACHE PATH
46     "Administrative binary installation directory")
47
48 SET(INCLUDE_INSTALL_DIR
49     "${CMAKE_INSTALL_PREFIX}/include"
50     CACHE PATH
51     "Include installation directory")
52
53 ############################# compiler flags ##################################
54
55 SET(CMAKE_CXX_FLAGS_PROFILING  "-O0 -g -pg")
56 SET(CMAKE_CXX_FLAGS_DEBUG      "-O0 -g -ggdb")
57 SET(CMAKE_CXX_FLAGS_RELEASE    "-O2 -g")
58 SET(CMAKE_CXX_FLAGS_CCOV       "-O2 -g --coverage")
59
60 # Check for C++11 support and enable proper compilation flags
61 CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
62 CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
63 IF(COMPILER_SUPPORTS_CXX11)
64     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
65 ELSEIF(COMPILER_SUPPORTS_CXX0X)
66     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
67 ELSE()
68     MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
69 ENDIF()
70
71 # Set compiler warning flags
72 ADD_DEFINITIONS("-Werror")                      # Make all warnings into errors.
73 ADD_DEFINITIONS("-Wall")                        # Generate all warnings
74 ADD_DEFINITIONS("-Wextra")                      # Generate even more extra warnings
75
76 # Don't export symbols by default
77 ADD_DEFINITIONS("-fvisibility=hidden")
78
79
80 IF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
81     ADD_DEFINITIONS("-DBUILD_TYPE_DEBUG")
82 ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
83
84 SET(TARGET_CYNARA "cynara")
85 SET(TARGET_LIB_CYNARA "cynara-client")
86 SET(TARGET_LIB_CYNARA_ASYNC "cynara-client-async")
87 SET(TARGET_LIB_CYNARA_COMMON "cynara-client-commons")
88 SET(TARGET_LIB_CYNARA_ADMIN "cynara-admin")
89 SET(TARGET_LIB_CYNARA_AGENT "cynara-agent")
90 SET(TARGET_CYNARA_COMMON "cynara-commons")
91 SET(TARGET_CYNARA_TESTS "cynara-tests")
92 SET(TARGET_LIB_CREDS_COMMONS "cynara-creds-commons")
93 SET(TARGET_LIB_CREDS_DBUS "cynara-creds-dbus")
94 SET(TARGET_LIB_CREDS_SOCKET "cynara-creds-socket")
95 SET(TARGET_LIB_SESSION "cynara-session")
96 SET(TARGET_LIB_CYNARA_STORAGE "cynara-storage")
97 SET(TARGET_CYAD "cyad")
98
99 ADD_SUBDIRECTORY(src)
100 ADD_SUBDIRECTORY(pkgconfig)
101 ADD_SUBDIRECTORY(systemd)
102 ADD_SUBDIRECTORY(migration)
103
104 IF (BUILD_TESTS)
105 ADD_SUBDIRECTORY(test)
106 ENDIF()