1 # Copyright (c) 2014-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 Adam Malinowski <a.malinowsk2@partner.samsung.com>
19 ############################# Check minimum CMake version #####################
21 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
23 set(ASKUSER_VERSION 0.1.0)
25 ############################# cmake packages ##################################
27 INCLUDE(FindPkgConfig)
28 INCLUDE(CheckCXXCompilerFlag)
30 ############################# install dirs ##################################
33 "${CMAKE_INSTALL_PREFIX}/bin"
35 "Binary installation directory")
37 ############################# compiler flags ##################################
39 SET(CMAKE_CXX_FLAGS_PROFILING "-O0 -g -pg")
40 SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -ggdb")
41 SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -g")
42 SET(CMAKE_CXX_FLAGS_CCOV "-O2 -g --coverage")
44 # Check for C++11 support and enable proper compilation flags
45 CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
46 CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
47 IF(COMPILER_SUPPORTS_CXX11)
48 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
49 ELSEIF(COMPILER_SUPPORTS_CXX0X)
50 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
52 MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
55 # Set compiler warning flags
56 ADD_DEFINITIONS("-Werror") # Make all warnings into errors.
57 ADD_DEFINITIONS("-Wall") # Generate all warnings
58 ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings
60 # Don't export symbols by default
61 ADD_DEFINITIONS("-fvisibility=hidden")
63 # Pass project name to sources
64 ADD_DEFINITIONS("-DPROJECT_NAME=\"${PROJECT_NAME}\"")
66 IF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
67 ADD_DEFINITIONS("-DBUILD_TYPE_DEBUG")
68 ENDIF (CMAKE_BUILD_TYPE MATCHES "DEBUG")
70 SET(TARGET_ASKUSER "askuser")
71 SET(TARGET_ASKUSER_COMMON "askuser-common")
72 SET(TARGET_PLUGIN_SERVICE "askuser-plugin-service")
73 SET(TARGET_PLUGIN_CLIENT "askuser-plugin-client")
74 SET(TARGET_CLIENT "askuser-test-client")
77 ADD_SUBDIRECTORY(systemd)
78 ADD_SUBDIRECTORY(test)