1 # Copyright (c) 2015 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 Aleksander Zdyb <a.zdyb@samsung.com>
17 # @author Oskar Ĺwitalski <o.switalski@samsung.com>
20 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
23 OPTION(WITH_TESTS "Build tests" ON)
25 ############################# compiler flags ##################################
27 SET(CMAKE_CXX_FLAGS_PROFILING "-O0 -g -pg")
28 SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -ggdb")
29 SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -g")
30 SET(CMAKE_CXX_FLAGS_CCOV "-O2 -g --coverage")
32 # Check for C++11 support and enable proper compilation flags
33 INCLUDE(CheckCXXCompilerFlag)
34 CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
35 IF(COMPILER_SUPPORTS_CXX11)
36 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
38 CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
39 IF(COMPILER_SUPPORTS_CXX0X)
40 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
42 MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
46 IF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
47 ADD_DEFINITIONS("-DBUILD_TYPE_DEBUG")
48 ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
51 "${CMAKE_INSTALL_PREFIX}/bin"
53 "User executables directory"
57 "${CMAKE_INSTALL_PREFIX}/sbin"
59 "System admin executables directory"
63 "${CMAKE_INSTALL_PREFIX}/etc"
65 "Read-only single-machine data directory"
68 INCLUDE(FindPkgConfig)
70 SET(TARGET_NICE_LAD "nice-lad")
73 ADD_SUBDIRECTORY(conf)
76 SET(TARGET_NICE_LAD_TESTS "nice-lad-tests")
77 ADD_SUBDIRECTORY(tests)