Ed Tanous | c9b5521 | 2017-06-12 13:25:51 -0700 | [diff] [blame] | 1 | # 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 | |
| 6 | project(boost-dbus CXX) |
| 7 | |
| 8 | set(CMAKE_CXX_STANDARD 14) |
| 9 | set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 10 | |
| 11 | ############### |
| 12 | # CMake options |
| 13 | cmake_minimum_required(VERSION 2.8) |
| 14 | |
| 15 | ############### |
| 16 | # C++ options |
| 17 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")#-std=c++0x") |
| 18 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) |
| 19 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/test) |
| 20 | |
| 21 | ############### |
| 22 | # import Boost |
Ed Tanous | 4d92cbf | 2017-06-22 15:41:02 -0700 | [diff] [blame] | 23 | add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY) |
| 24 | add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED) |
| 25 | add_definitions(-DBOOST_ALL_NO_LIB) |
Ed Tanous | c9b5521 | 2017-06-12 13:25:51 -0700 | [diff] [blame] | 26 | find_package(Boost REQUIRED) |
Ed Tanous | 4d92cbf | 2017-06-22 15:41:02 -0700 | [diff] [blame] | 27 | |
Ed Tanous | c9b5521 | 2017-06-12 13:25:51 -0700 | [diff] [blame] | 28 | include_directories(${Boost_INCLUDE_DIRS}) |
| 29 | link_directories(${Boost_LIBRARY_DIRS}) |
| 30 | |
| 31 | ############### |
| 32 | # import D-Bus |
| 33 | find_package(PkgConfig REQUIRED) |
| 34 | pkg_check_modules(DBus dbus-1) |
| 35 | include_directories(${DBus_INCLUDE_DIRS}) |
| 36 | link_directories(${DBus_LIBRARY_DIRS}) |
| 37 | |
| 38 | ############## |
| 39 | # import GTest |
| 40 | find_package(GTest REQUIRED) |
| 41 | include_directories(${GTEST_INCLUDE_DIRS}) |
| 42 | |
| 43 | ############## |
| 44 | # Tests |
| 45 | enable_testing() |
| 46 | |
| 47 | |
| 48 | add_executable(dbustests "test/avahi.cpp" "test/message.cpp") |
| 49 | target_link_libraries(dbustests ${Boost_LIBRARIES}) |
| 50 | target_link_libraries(dbustests ${DBus_LIBRARIES}) |
| 51 | target_link_libraries(dbustests ${GTEST_BOTH_LIBRARIES} gmock) |
Ed Tanous | 5fceeb4 | 2017-06-28 09:43:09 -0700 | [diff] [blame^] | 52 | target_link_libraries(dbustests pthread) |
Ed Tanous | c9b5521 | 2017-06-12 13:25:51 -0700 | [diff] [blame] | 53 | add_test(dbustests dbustests "--gtest_output=xml:${test_name}.xml") |
| 54 | |