Debian Codegraph @

CMakeLists.txt

raw
1 cmake_minimum_required (VERSION 3.13)
2 project (libayatana-common VERSION "0.9.13" LANGUAGES C CXX)
3
4 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
5
6 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
7 SET(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "..." FORCE)
8 endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
9
10 set(GETTEXT_PACKAGE "ayatana-common")
11 set(API_VERSION 0)
12 set(ABI_VERSION 0)
13
14 # Options
15 option(ENABLE_TESTS "Enable all tests and checks" OFF)
16 option(ENABLE_COVERAGE "Enable coverage reports (includes enabling all tests and checks)" OFF)
17 option(ENABLE_WERROR "Treat all build warnings as errors" OFF)
18 option(ENABLE_LOMIRI_FEATURES "Build with Lomiri-specific libraries, schemas and media" OFF)
19
20 if(ENABLE_COVERAGE)
21 set(ENABLE_TESTS ON)
22 set(CMAKE_BUILD_TYPE "Coverage")
23 else()
24 set(CMAKE_BUILD_TYPE "Release")
25 endif()
26
27 if(ENABLE_WERROR)
28 add_definitions("-Werror")
29 endif()
30
31 if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
32 add_definitions("-Weverything")
33 else()
34 add_definitions("-Wall")
35 endif()
36
37 # GNU standard installation directories
38 include (GNUInstallDirs)
39
40 # Check for prerequisites
41 find_package (PkgConfig REQUIRED)
42 include (FindPkgConfig)
43
44 set (
45 DEPS
46 glib-2.0>=2.36
47 gio-2.0>=2.36
48 )
49
50 if (ENABLE_LOMIRI_FEATURES)
51 list (
52 APPEND
53 DEPS
54 lomiri-url-dispatcher>=0
55 )
56 endif ()
57
58 pkg_check_modules (DEPS REQUIRED ${DEPS})
59 include_directories (${DEPS_INCLUDE_DIRS})
60
61 # for GIR and Vala bindings
62 find_package (GObjectIntrospection QUIET)
63 find_package (Vala QUIET)
64
65 add_subdirectory(src)
66 add_subdirectory(data)
67 add_subdirectory(po)
68
69 if (ENABLE_TESTS)
70 include(CTest)
71 enable_testing()
72 add_subdirectory(tests)
73 if (ENABLE_COVERAGE)
74 find_package(CoverageReport)
75 ENABLE_COVERAGE_REPORT(
76 TARGETS "ayatana-common"
77 TESTS "tst_utils" "tst_utils_vala"
78 FILTER /usr/include ${CMAKE_BINARY_DIR}/*
79 )
80 endif()
81 endif()
82
83 # Display config info
84
85 message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
86 message(STATUS "Unit tests: ${ENABLE_TESTS}")
87 message(STATUS "Build with -Werror: ${ENABLE_WERROR}")
88
89 if (INTROSPECTION_FOUND)
90 message(STATUS "Build GObjectIntrospection: YES")
91 if (VALA_COMPILER)
92 message(STATUS "Build Vala bindings: YES")
93 else()
94 message(STATUS "Build Vala bindings: NO")
95 endif()
96 else()
97 message(STATUS "Build GObjectIntrospection: NO")
98 endif()
99
100 message(STATUS "Build with Lomiri features: ${ENABLE_LOMIRI_FEATURES}")