summaryrefslogtreecommitdiff
path: root/unittest/CMakeLists.txt
blob: 701c4ecf5bba47a1e33d5b951815dcdfe3a99663 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Copyright (c) 2014-2017 Samsung Electronics Co., Ltd All Rights Reserved
#
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.
#
# @file        CMakeLists.txt
# @author
# @author
# @brief       Cmake for tests
#

LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/include)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/lib)

SET(TARGET_GTEST_TESTS "gtest-beluga-launcher")

FILE(GLOB TARGET_GTEST_TESTS_SRCS
  beluga-launcher_dzl_dockerctl.cpp
  beluga-launcher_dzl_dockerform.cpp
  beluga-launcher_dzl_lifecycle.cpp
  beluga-launcher_dzl_setting.cpp
  beluga-launcher_main.cpp
  ${CMAKE_SOURCE_DIR}/src/dzl_dockerform.c
  ${CMAKE_SOURCE_DIR}/src/dzl_lifecycle.c
  ${CMAKE_SOURCE_DIR}/src/dzl_dockercomm.c
  ${CMAKE_SOURCE_DIR}/src/dzl_dockerctl.c
  ${CMAKE_SOURCE_DIR}/src/dzl_setting.c
  ${CMAKE_SOURCE_DIR}/src/lib/json_util.c
  ${CMAKE_SOURCE_DIR}/src/lib/yaml_util.c)

INCLUDE(FindPkgConfig)

IF(NONE_GBS_BUILD)
  INCLUDE_DIRECTORIES(${LINK_LIB_INCLUDE})
  SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fprofile-arcs -ftest-coverage")
  set(CMAKE_EXE_LINKER_FLAGS ${LINK_FLAG})
ELSE(NONE_GBS_BUILD)
  pkg_check_modules(gtest_pkgs REQUIRED dlog glib-2.0 libcurl json-c gmock)
ENDIF(NONE_GBS_BUILD)

INCLUDE_DIRECTORIES(${gtest_pkgs_INCLUDE_DIRS})
LINK_DIRECTORIES(${gtest_pkgs_LIBRARY_DIRS})

ADD_EXECUTABLE(${TARGET_GTEST_TESTS} ${TARGET_GTEST_TESTS_SRCS})

TARGET_LINK_LIBRARIES(${TARGET_GTEST_TESTS} ${gtest_pkgs_LIBRARIES} gmock json-c curl pthread yaml gcov --coverage)
INSTALL(TARGETS ${TARGET_GTEST_TESTS} DESTINATION ${BIN_INSTALL_DIR})