lxcpp: fix cgroup unit tests
[platform/core/security/vasum.git] / server / CMakeLists.txt
1 # Copyright (c) 2014 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 #
16 # @file   CMakeLists.txt
17 # @author Jan Olszak (j.olszak@samsung.com)
18 #
19
20 MESSAGE(STATUS "")
21 MESSAGE(STATUS "Generating makefile for the Server...")
22 FILE(GLOB               project_SRCS *.cpp *.hpp)
23
24
25 ## Setup target ################################################################
26 SET(SERVER_CODENAME "${PROJECT_NAME}-server")
27 ADD_EXECUTABLE(${SERVER_CODENAME} ${project_SRCS})
28
29 ADD_DEPENDENCIES(${SERVER_CODENAME} Common Logger Config Ipc)
30
31 ## Link libraries ##############################################################
32 FIND_PACKAGE(Boost COMPONENTS program_options system filesystem ${USE_BOOST_REGEX})
33 PKG_CHECK_MODULES(SERVER_DEPS REQUIRED lxc glib-2.0 gio-2.0)
34
35 INCLUDE_DIRECTORIES(${COMMON_FOLDER})
36 INCLUDE_DIRECTORIES(${LIBS_FOLDER})
37 INCLUDE_DIRECTORIES(${CLIENT_FOLDER})
38 INCLUDE_DIRECTORIES(SYSTEM ${SERVER_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${JSON_C_INCLUDE_DIRS})
39
40 SET_TARGET_PROPERTIES(${SERVER_CODENAME} PROPERTIES
41     COMPILE_FLAGS "-pthread"
42     COMPILE_DEFINITIONS HOST_IPC_SOCKET="${VSM_SERVER_IPC_SOCKET_PATH}"
43     LINK_FLAGS "-pthread"
44 )
45
46 TARGET_LINK_LIBRARIES(${SERVER_CODENAME} Common ${SERVER_DEPS_LIBRARIES} ${Boost_LIBRARIES} Logger Config Ipc)
47 IF(NOT WITHOUT_DBUS)
48 TARGET_LINK_LIBRARIES(${SERVER_CODENAME} SimpleDbus)
49 ENDIF(NOT WITHOUT_DBUS)
50
51 ## Subdirectories ##############################################################
52 ADD_SUBDIRECTORY(configs)
53
54
55 ## Install #####################################################################
56 INSTALL(TARGETS ${SERVER_CODENAME} DESTINATION bin)
57
58 ## Set capabilities on server executable #######################################
59 INSTALL(CODE "EXECUTE_PROCESS(COMMAND setcap CAP_SYS_ADMIN,CAP_MAC_OVERRIDE,CAP_SYS_TTY_CONFIG+ei \$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/bin/${SERVER_CODENAME})")
60
61 INSTALL(PROGRAMS "scripts/vasum-check-config.sh" DESTINATION sbin RENAME vasum-check-config)