Revise directory structure
[platform/core/connectivity/asp-manager.git] / unittest / CMakeLists.txt
1 # Copyright (c) 2014-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 #
17
18 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
19 SET(GTEST_TEST "gtest-asp-manager")
20
21 INCLUDE(FindPkgConfig)
22 PKG_CHECK_MODULES(gtest_pkgs REQUIRED glib-2.0 gmock)
23
24 INCLUDE_DIRECTORIES(${gtest_pkgs_INCLUDE_DIRS})
25 LINK_DIRECTORIES(${gtest_pkgs_LIBRARY_DIRS})
26
27 INCLUDE_DIRECTORIES(${asp_pkgs_INCLUDE_DIRS})
28
29 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
30 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/interfaces)
31
32 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/unittest)
33
34 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpie")
35 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpie")
36
37 SET(SRCS
38         ${CMAKE_SOURCE_DIR}/src/asp-manager.c
39         ${CMAKE_SOURCE_DIR}/src/asp-manager-event.c
40         ${CMAKE_SOURCE_DIR}/src/asp-manager-gdbus.c
41         ${CMAKE_SOURCE_DIR}/src/asp-manager-util.c
42         ${CMAKE_SOURCE_DIR}/interfaces/generated-code.c
43         )
44
45 SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/interfaces/generated-code.c PROPERTIES GENERATED TRUE)
46
47 FILE(GLOB SERVICE_SRCS ${CMAKE_SOURCE_DIR}/src/service/*.c)
48 FILE(GLOB SESSION_SRCS ${CMAKE_SOURCE_DIR}/src/session/*.c)
49 FILE(GLOB TECH_SRCS ${CMAKE_SOURCE_DIR}/src/tech/*.c)
50 FILE(GLOB GTEST_SRCS
51         ${CMAKE_SOURCE_DIR}/unittest/*.cpp
52         ${CMAKE_SOURCE_DIR}/unittest/service/*.cpp
53         ${CMAKE_SOURCE_DIR}/unittest/session/*.cpp
54         )
55
56 ADD_DEFINITIONS("-DUSE_DLOG")
57
58 ADD_EXECUTABLE(${GTEST_TEST} ${SRCS} ${SERVICE_SRCS} ${SESSION_SRCS} ${TECH_SRCS} ${GTEST_SRCS})
59 ADD_DEPENDENCIES(${GTEST_TEST} GENERATED_DBUS_CODE)
60
61 TARGET_LINK_LIBRARIES(${GTEST_TEST} ${gtest_pkgs_LIBRARIES} ${asp_pkgs_LDFLAGS} -ldl)
62
63 INSTALL(TARGETS ${GTEST_TEST} RUNTIME DESTINATION ${BIN_DIR})