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.
16 # @file CMakeLists.txt
17 # @author Jan Olszak (j.olszak@samsung.com)
20 CMAKE_MINIMUM_REQUIRED (VERSION 2.6.2)
21 PROJECT(security-containers)
23 ## pkgconfig ###################################################################
24 INCLUDE(FindPkgConfig)
26 ## File names ##################################################################
27 SET(SERVER_CODENAME "${PROJECT_NAME}-server")
28 SET(CLIENT_CODENAME "${PROJECT_NAME}-client")
31 ## Generate the pc file ########################################################
32 CONFIGURE_FILE(security-containers.pc.in security-containers.pc @ONLY)
35 ## Compiler flags, depending on the build type #################################
36 MESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
37 SET(CMAKE_C_FLAGS_PROFILING "-g -O0 -pg")
38 SET(CMAKE_CXX_FLAGS_PROFILING "-g -std=c++0x -O0 -pg")
39 SET(CMAKE_C_FLAGS_DEBUG "-g -O0 -ggdb")
40 SET(CMAKE_CXX_FLAGS_DEBUG "-g -std=c++0x -O0 -ggdb")
41 SET(CMAKE_C_FLAGS_RELEASE "-g -O2")
42 SET(CMAKE_CXX_FLAGS_RELEASE "-g -std=c++0x -O2")
43 SET(CMAKE_C_FLAGS_CCOV "-g -O2 --coverage")
44 SET(CMAKE_CXX_FLAGS_CCOV "-g -std=c++0x -O2 --coverage")
46 ADD_DEFINITIONS("-fPIC") # Position Independent Code
47 ADD_DEFINITIONS("-Werror") # Make all warnings into errors
48 ADD_DEFINITIONS("-Wall") # Generate all warnings
49 ADD_DEFINITIONS("-Wextra") # Generate even more extra warnings
50 ADD_DEFINITIONS("-pedantic") # Be pedantic
51 ADD_DEFINITIONS("-pedantic-errors") # Make pedantic warnings into errors
54 ## Subdirectories ##############################################################
55 SET(CLIENT_FOLDER ${PROJECT_SOURCE_DIR}/src/client)
56 SET(SERVER_FOLDER ${PROJECT_SOURCE_DIR}/src/server)
60 ## Installations ###############################################################
61 # FILE(MAKE_DIRECTORY /usr/include/security-containers)
62 INSTALL(FILES ${CLIENT_FOLDER}/include/security-containers-client.h
63 DESTINATION /usr/include/security-containers)
65 INSTALL(FILES ${CMAKE_BINARY_DIR}/security-containers.pc
66 DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
68 INSTALL(FILES ${SERVER_FOLDER}/config/daemon.json
69 DESTINATION /etc/security-containers/config/)
71 INSTALL(FILES ${SERVER_FOLDER}/config/libvirt-config/xminimal.xml
72 DESTINATION /etc/security-containers/config/libvirt-config)