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) 16include_directories(${CMAKE_SOURCE_DIR}/test) 17 18############### 19# import Boost 20find_package(Boost 1.54 COMPONENTS system chrono REQUIRED) 21include_directories(${Boost_INCLUDE_DIRS}) 22link_directories(${Boost_LIBRARY_DIRS}) 23 24############### 25# import D-Bus 26find_package(PkgConfig REQUIRED) 27pkg_check_modules(DBus dbus-1) 28include_directories(${DBus_INCLUDE_DIRS}) 29link_directories(${DBus_LIBRARY_DIRS}) 30 31############## 32# import GTest 33find_package(GTest REQUIRED) 34include_directories(${GTEST_INCLUDE_DIRS}) 35 36############## 37# Tests 38enable_testing() 39 40function(cxx_test test_name) 41 add_executable(${test_name} "test/${test_name}.cpp") 42 target_link_libraries(${test_name} ${Boost_LIBRARIES}) 43 target_link_libraries(${test_name} ${DBus_LIBRARIES}) 44 target_link_libraries(${test_name} ${GTEST_BOTH_LIBRARIES}) 45 target_link_libraries(${test_name} -pthread) 46 add_test(${test_name} ${test_name} "--gtest_output=xml:${test_name}.xml") 47endfunction(cxx_test) 48 49cxx_test(avahi) 50cxx_test(message) 51