cmake_minimum_required(VERSION 2.8) project(Unity-Mir) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed. set(CMAKE_AUTOMOC ON) include(GNUInstallDirs) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -pedantic -Wextra") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fno-strict-aliasing -pedantic -Wextra") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") option(Werror "Treat warnings as errors" ON) if (Werror) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wno-error=format") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=format") endif() if(NOT CMAKE_BUILD_TYPE) message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") set(CMAKE_BUILD_TYPE RelWithDebInfo) endif() string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower) if(cmake_build_type_lower MATCHES relwithdebinfo) # workaround for http://public.kitware.com/Bug/view.php?id=14696 add_definitions(-DQT_NO_DEBUG) endif() # Disable Qt keywords add_definitions(-DQT_NO_KEYWORDS) ##################################################################### # 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_lower MATCHES coverage) 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_lower MATCHES coverage) include(CTest) set(UNITY_MIR_VERSION_MAJOR 1) set(UNITY_MIR_VERSION_MINOR 0) set(UNITY_MIR_VERSION_PATCH 0) find_package(PkgConfig REQUIRED) find_package(Threads REQUIRED) find_package(Qt5Core REQUIRED) find_package(Qt5Quick REQUIRED) find_package(Qt5DBus REQUIRED) find_package(Boost 1.50 COMPONENTS system REQUIRED) find_package(Protobuf REQUIRED) if(PROTOBUF_PROTOC_EXECUTABLE STREQUAL "PROTOBUF_PROTOC_EXECUTABLE-NOTFOUND") message(SEND_ERROR "protoc executable not found! Missing protobuf-compiler package?") endif() pkg_check_modules(MIRSERVER mirserver REQUIRED) pkg_check_modules(MIRCOMMON mircommon REQUIRED) pkg_check_modules(UBUNTU_PLATFORM_API ubuntu-platform-api REQUIRED) add_subdirectory(src) add_subdirectory(data) add_subdirectory(tests) # TODO(tvoss): Enable coverage reporting once we have tests in place. #enable_coverage_report(posix_process_test linux_process_test)