# Copyright © 2013 Canonical Ltd. # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License version 3, # as published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authors: # Antti Kaijanmäki cmake_minimum_required(VERSION 2.8) project(connectivity-cpp) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) include(EnableCoverageReport) include(GNUInstallDirs) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -Wextra -fPIC -fvisibility=hidden -pthread") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -pedantic -Wextra -fPIC -pthread") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") ##################################################################### # Enable code coverage calculation with gcov/gcovr/lcov # Usage: # * Switch build type to coverage (use ccmake or cmake-gui) # * Invoke make, make test, make coverage # * Find html report in subdir coveragereport # * Find xml report feasible for jenkins in coverage.xml ##################################################################### IF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE]) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs" ) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftest-coverage -fprofile-arcs" ) SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" ) SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" ) ENDIF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE]) set(CONNECTIVITY_CPP_VERSION_MAJOR 0) set(CONNECTIVITY_CPP_VERSION_MINOR 0) set(CONNECTIVITY_CPP_VERSION_PATCH 1) include(CTest) find_package(PkgConfig REQUIRED) include_directories(include) include_directories(dbus-cpp) pkg_check_modules( PROPERTIESCPP REQUIRED properties-cpp ) include_directories(${PROPERTIESCPP_INCLUDE_DIRS}) pkg_check_modules( DBUSCPP REQUIRED dbus-cpp ) include_directories(${DBUSCPP_INCLUDE_DIRS}) # list these here to have them visible in Qt Creator set(CONNECTIVITY_INTERFACES include/com/ubuntu/connectivity/networking/link.h include/com/ubuntu/connectivity/networking/manager.h include/com/ubuntu/connectivity/networking/service.h include/com/ubuntu/connectivity/networking/service/tethering/service.h include/com/ubuntu/connectivity/networking/service/tor/service.h include/com/ubuntu/connectivity/networking/service/vpn/service.h include/com/ubuntu/connectivity/networking/wifi/access-point.h include/com/ubuntu/connectivity/networking/wifi/link.h include/com/ubuntu/connectivity/networking/wwan/link.h ) add_custom_target(QtCreatorHeaderHack SOURCES ${CONNECTIVITY_INTERFACES}) add_subdirectory(data) add_subdirectory(doc) add_subdirectory(examples) add_subdirectory(tests) add_subdirectory(src) install( DIRECTORY include DESTINATION include/connectivity-cpp-${CONNECTIVITY_CPP_VERSION_MAJOR} ) enable_coverage_report(TARGETS connectivity_cpp FILTER ${CMAKE_SOURCE_DIR}/tests/* ${CMAKE_BINARY_DIR}/*)