File: CMakeLists.txt

package info (click to toggle)
deviceinfo 0.2.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 408 kB
  • sloc: cpp: 1,488; ansic: 33; makefile: 10
file content (54 lines) | stat: -rw-r--r-- 1,528 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
cmake_minimum_required(VERSION 3.10)
project(deviceinfo VERSION 0.2.4)
set(CMAKE_CXX_STANDARD 17)

set(VERSION_MAJOR 0)
set(VERSION_MINOR 2)
set(VERSION_PATCH 0)

include(FindPkgConfig)
include(GNUInstallDirs)

option(DISABLE_TESTS "Disable tests" off)
option(WITH_EXTRAS "Build extra component(s)" off)

pkg_search_module(YAMLCPP yaml-cpp REQUIRED)
pkg_search_module(ANDROIDPROPS libandroid-properties)
if(NOT ANDROIDPROPS_FOUND)
    message(WARNING "Did not find android properties, bulding without!")
endif()

set(TARGET deviceinfo)

include_directories(headers)

set(CONFIG_PATH ${CMAKE_INSTALL_FULL_SYSCONFDIR}/deviceinfo CACHE STRING "")
install(DIRECTORY configs/ DESTINATION ${CONFIG_PATH})

add_subdirectory(headers)
add_subdirectory(src)
add_subdirectory(tools)

if (DISABLE_TESTS)
    message(STATUS "Tests disabled")
else()
    include(CTest)
    enable_testing()
    add_subdirectory(tests)
endif()

if (WITH_EXTRAS)
    pkg_check_modules(GLib REQUIRED IMPORTED_TARGET glib-2.0 gio-2.0)
    add_subdirectory(extras)
endif ()

# Coverage
#####################################################################
# 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
#####################################################################
find_package(CoverageReport)