1 # Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 # @file CMakeLists.txt
16 # @author Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
17 # @author Radoslaw Bartosiak <r.bartosiak@samsung.com>
20 ############################# Check minimum CMake version #####################
22 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
24 set(CYNARA_VERSION 0.2.2)
26 ############################# cmake packages ##################################
28 INCLUDE(FindPkgConfig)
29 INCLUDE(CheckCXXCompilerFlag)
31 ############################# install dirs ##################################
34 "${CMAKE_INSTALL_PREFIX}/lib"
36 "Library installation directory")
39 "${CMAKE_INSTALL_PREFIX}/bin"
41 "Binary installation directory")
43 SET(INCLUDE_INSTALL_DIR
44 "${CMAKE_INSTALL_PREFIX}/include"
46 "Include installation directory")
48 ############################# compiler flags ##################################
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")
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")
63 MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
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
71 # Don't export symbols by default
72 ADD_DEFINITIONS("-fvisibility=hidden")
75 IF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
76 ADD_DEFINITIONS("-DBUILD_TYPE_DEBUG")
77 ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
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")
92 ADD_SUBDIRECTORY(pkgconfig)
93 ADD_SUBDIRECTORY(systemd)
96 ADD_SUBDIRECTORY(test)