project(settings-components) cmake_minimum_required(VERSION 2.8.9) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) # Install paths include(GNUInstallDirs) include(FindPkgConfig) find_package(Qt5Quick REQUIRED) set(OUR_QT_QUICK_LIB ${Qt5Quick_LIBRARIES}) get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION) exec_program(${QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_QML" OUTPUT_VARIABLE QT_IMPORTS_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) file(TO_CMAKE_PATH "${QT_IMPORTS_DIR}" QT_IMPORTS_DIR) set(OUR_QT_QUICK_INCLUDE ${Qt5Quick_INCLUDE_DIRS}) LIST(APPEND QT_PKGCONFIG_DEPENDENCIES "Qt5Quick") find_package(Qt5Core REQUIRED) find_package(Qt5Quick REQUIRED) find_package(Qt5Widgets REQUIRED) add_definitions(-DQT_NO_KEYWORDS) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) # enable QML debugging string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower) # Build types should always be lowercase but sometimes they are not. if(cmake_build_type_lower MATCHES "debug") add_definitions(-DQT_QML_DEBUG) endif() include(EnableCoverageReport) ##################################################################### # 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 (or ninja if you use that backend) # * 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} --coverage" ) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage" ) set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --coverage" ) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage" ) ENABLE_COVERAGE_REPORT(TARGETS ${SHELL_APP} FILTER /usr/include ${CMAKE_SOURCE_DIR}/tests/* ${CMAKE_BINARY_DIR}/*) endif() configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") # Doc OPTION(GENERATE_DOC "Enable qdoc generation" OFF) if(GENERATE_DOC) message(STATUS "QDoc enabled.") find_program(QDOC_BIN qdoc) if(NOT QDOC_BIN) message(FATAL_ERROR "qdoc command not found") else() add_subdirectory(doc) endif() endif() # Tests enable_testing() add_subdirectory(Ubuntu) add_subdirectory(tests)