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>
19 ############################# Check minimum CMake version #####################
21 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
24 ############################# cmake packages ##################################
26 INCLUDE(FindPkgConfig)
27 INCLUDE(CheckCXXCompilerFlag)
29 ############################# compiler flags ##################################
31 SET(CMAKE_CXX_FLAGS_PROFILING "-O0 -g -pg")
32 SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -ggdb")
33 SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -g")
34 SET(CMAKE_CXX_FLAGS_CCOV "-O2 -g --coverage")
36 # Check for C++11 support and enable proper compilation flags
37 CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
38 CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
39 IF(COMPILER_SUPPORTS_CXX11)
40 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
41 ELSEIF(COMPILER_SUPPORTS_CXX0X)
42 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
44 MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
47 # Set compiler warning flags
48 ADD_DEFINITIONS("-Werror") # Make all warnings into errors.
49 ADD_DEFINITIONS("-Wall") # Generate all warnings
50 ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings
52 # Don't export symbols by default
53 ADD_DEFINITIONS("-fvisibility=hidden")
56 IF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
57 ADD_DEFINITIONS("-DBUILD_TYPE_DEBUG")
58 ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
60 SET(TARGET_CYNARA "cynara")
61 SET(TARGET_LIB_CYNARA "cynara-client")
62 SET(TARGET_LIB_CYNARA_COMMON "cynara-client-commons")
63 SET(TARGET_LIB_CYNARA_ADMIN "cynara-admin")
64 SET(TARGET_CYNARA_COMMON "cynara-commons")
65 SET(TARGET_CYNARA_TESTS "cynara-tests")
68 ADD_SUBDIRECTORY(test)
69 ADD_SUBDIRECTORY(pkgconfig)
70 ADD_SUBDIRECTORY(systemd)