ffbe771491b15b923eecc4b904375efb2695c4c0
[platform/core/security/nice-lad.git] / CMakeLists.txt
1 # Copyright (c) 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      Aleksander Zdyb <a.zdyb@samsung.com>
17 #
18
19 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
20 PROJECT(nice-lad)
21
22 OPTION(WITH_TESTS "Build tests" ON)
23
24 # Check for C++11 support and enable proper compilation flags
25 INCLUDE(CheckCXXCompilerFlag)
26 CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
27 IF(COMPILER_SUPPORTS_CXX11)
28     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
29 ELSE()
30     CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
31     IF(COMPILER_SUPPORTS_CXX0X)
32         SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
33     ELSE()
34         MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
35     ENDIF()
36 ENDIF()
37
38 SET(BIN_DIR
39     "${CMAKE_INSTALL_PREFIX}/bin"
40     CACHE PATH
41     "User executables directory"
42 )
43
44 SET(SBIN_DIR
45     "${CMAKE_INSTALL_PREFIX}/sbin"
46     CACHE PATH
47     "System admin executables directory"
48 )
49
50 SET(SYS_CONFIG_DIR
51     "${CMAKE_INSTALL_PREFIX}/etc"
52     CACHE PATH
53     "Read-only single-machine data directory"
54 )
55
56 INCLUDE(FindPkgConfig)
57
58 SET(TARGET_NICE_LAD "nice-lad")
59
60 ADD_SUBDIRECTORY(src)
61 ADD_SUBDIRECTORY(conf)
62
63 IF(WITH_TESTS)
64     SET(TARGET_NICE_LAD_TESTS "nice-lad-tests")
65     ADD_SUBDIRECTORY(tests)
66 ENDIF(WITH_TESTS)