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 6project(boost-dbus CXX) 7 8############### 9# CMake options 10cmake_minimum_required(VERSION 2.8) 11 12############### 13# C++ options 14set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++0x") 15include_directories(${CMAKE_SOURCE_DIR}/include) 16 17############### 18# import Boost 19find_package(Boost 1.54 COMPONENTS system REQUIRED) 20include_directories(${Boost_INCLUDE_DIRS}) 21link_directories(${Boost_LIBRARY_DIRS}) 22 23############### 24# import D-Bus 25find_package(PkgConfig REQUIRED) 26pkg_check_modules(DBus dbus-1) 27include_directories(${DBus_INCLUDE_DIRS}) 28link_directories(${DBus_LIBRARY_DIRS}) 29 30############## 31# import GTest 32find_package(GTest REQUIRED) 33include_directories(${GTEST_INCLUDE_DIRS}) 34 35############## 36# Tests 37enable_testing() 38 39function(cxx_test test_name) 40 add_executable(${test_name} "test/${test_name}.cpp") 41 target_link_libraries(${test_name} ${Boost_LIBRARIES}) 42 target_link_libraries(${test_name} ${DBus_LIBRARIES}) 43 target_link_libraries(${test_name} ${GTEST_BOTH_LIBRARIES}) 44 target_link_libraries(${test_name} -pthread) 45 add_test(${test_name} ${test_name} "--gtest_output=xml:${test_name}.xml") 46endfunction(cxx_test) 47 48cxx_test(avahi) 49cxx_test(message) 50