blob: 57bd8bdbed810ae4f14657cbbd9d8998606eb0a3 [file] [log] [blame]
Ed Tanousc9b55212017-06-12 13:25:51 -07001# Copyright (c) Benjamin Kietzman (github.com/bkietz)
2#
3# Distributed under the Boost Software License, Version 1.0. (See accompanying
4# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6project(boost-dbus CXX)
7
8set(CMAKE_CXX_STANDARD 14)
9set(CMAKE_CXX_STANDARD_REQUIRED ON)
10
11###############
12# CMake options
13cmake_minimum_required(VERSION 2.8)
14
15###############
16# C++ options
17set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")#-std=c++0x")
18include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
19include_directories(${CMAKE_CURRENT_SOURCE_DIR}/test)
20
21###############
22# import Boost
Ed Tanous4d92cbf2017-06-22 15:41:02 -070023add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
24add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED)
25add_definitions(-DBOOST_ALL_NO_LIB)
Ed Tanousc9b55212017-06-12 13:25:51 -070026find_package(Boost REQUIRED)
Ed Tanous4d92cbf2017-06-22 15:41:02 -070027
Ed Tanousc9b55212017-06-12 13:25:51 -070028include_directories(${Boost_INCLUDE_DIRS})
29link_directories(${Boost_LIBRARY_DIRS})
30
31###############
32# import D-Bus
33find_package(PkgConfig REQUIRED)
34pkg_check_modules(DBus dbus-1)
35include_directories(${DBus_INCLUDE_DIRS})
36link_directories(${DBus_LIBRARY_DIRS})
37
38##############
39# import GTest
40find_package(GTest REQUIRED)
41include_directories(${GTEST_INCLUDE_DIRS})
42
43##############
44# Tests
45enable_testing()
46
47
48add_executable(dbustests "test/avahi.cpp" "test/message.cpp")
49target_link_libraries(dbustests ${Boost_LIBRARIES})
50target_link_libraries(dbustests ${DBus_LIBRARIES})
51target_link_libraries(dbustests ${GTEST_BOTH_LIBRARIES} gmock)
Ed Tanous5fceeb42017-06-28 09:43:09 -070052target_link_libraries(dbustests pthread)
Ed Tanousc9b55212017-06-12 13:25:51 -070053add_test(dbustests dbustests "--gtest_output=xml:${test_name}.xml")
54