IPC: External polling loop with a Client
[platform/core/security/vasum.git] / tests / unit_tests / 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 Unit Tests...")
22 FILE(GLOB_RECURSE project_SRCS *.cpp *.hpp)
23 FILE(GLOB_RECURSE common_SRCS ${COMMON_FOLDER}/*.cpp ${COMMON_FOLDER}/*.hpp)
24 FILE(GLOB         server_SRCS ${SERVER_FOLDER}/*.cpp ${SERVER_FOLDER}/*.hpp)
25 FILE(GLOB         client_SRCS ${CLIENT_FOLDER}/*.cpp ${CLIENT_FOLDER}/*.h)
26
27 FILE(GLOB         main_SRC ${SERVER_FOLDER}/main.cpp)
28 LIST(REMOVE_ITEM server_SRCS ${main_SRC})
29
30
31 ## Setup target ################################################################
32 SET(UT_SERVER_CODENAME "${PROJECT_NAME}-server-unit-tests")
33 ADD_EXECUTABLE(${UT_SERVER_CODENAME} ${project_SRCS} ${common_SRCS} ${server_SRCS} ${client_SRCS})
34
35
36 ## Link libraries ##############################################################
37 FIND_PACKAGE (Boost COMPONENTS unit_test_framework system filesystem regex)
38
39 PKG_CHECK_MODULES(UT_SERVER_DEPS REQUIRED lxc json gio-2.0 libsystemd-daemon
40                   libsystemd-journal libcap-ng libLogger libSimpleDbus libConfig)
41 INCLUDE_DIRECTORIES(${COMMON_FOLDER} ${SERVER_FOLDER} ${UNIT_TESTS_FOLDER} ${CLIENT_FOLDER})
42 INCLUDE_DIRECTORIES(SYSTEM ${UT_SERVER_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
43
44 SET_TARGET_PROPERTIES(${UT_SERVER_CODENAME} PROPERTIES
45     COMPILE_FLAGS "-pthread"
46     LINK_FLAGS "-pthread"
47 )
48
49 TARGET_LINK_LIBRARIES(${UT_SERVER_CODENAME} ${UT_SERVER_DEPS_LIBRARIES} ${Boost_LIBRARIES})
50
51
52 ## Subdirectories ##############################################################
53 SET(VSM_TEST_CONFIG_INSTALL_DIR ${VSM_DATA_INSTALL_DIR}/tests)
54 SET(VSM_TEST_LXC_TEMPLATES_INSTALL_DIR ${VSM_DATA_INSTALL_DIR}/lxc-templates/tests)
55 ADD_DEFINITIONS(-DVSM_TEST_CONFIG_INSTALL_DIR="${VSM_TEST_CONFIG_INSTALL_DIR}")
56 ADD_DEFINITIONS(-DVSM_TEST_LXC_TEMPLATES_INSTALL_DIR="${VSM_TEST_LXC_TEMPLATES_INSTALL_DIR}")
57
58 ADD_SUBDIRECTORY(dbus/configs)
59 ADD_SUBDIRECTORY(server/configs)
60 ADD_SUBDIRECTORY(utils/configs)
61 ADD_SUBDIRECTORY(client/configs)
62 ADD_SUBDIRECTORY(lxc/templates)
63
64
65 ## Install #####################################################################
66 INSTALL(TARGETS ${UT_SERVER_CODENAME} DESTINATION bin)