forked from ubports/morph-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
97 lines (77 loc) · 3.3 KB
/
CMakeLists.txt
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
cmake_minimum_required(VERSION 2.8.9)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
project("webbrowser")
find_program(INTLTOOL_MERGE intltool-merge)
if(NOT INTLTOOL_MERGE)
message(FATAL_ERROR "Could not find intltool-merge, please install the intltool package")
endif()
find_program(INTLTOOL_EXTRACT intltool-extract)
if(NOT INTLTOOL_EXTRACT)
message(FATAL_ERROR "Could not find intltool-extract, please install the intltool package")
endif()
option(CLICK_MODE "Build as a click package" off)
# Standard install paths
include(GNUInstallDirs)
#set install paths
if(CLICK_MODE)
set(CMAKE_INSTALL_PREFIX "/")
set(CMAKE_INSTALL_BINDIR "/")
set(CMAKE_INSTALL_FULL_DATADIR "./share")
add_definitions("-DCLICK_MODE")
endif()
string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower)
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(EXCLUDES tests/*|.*moc_.*.cpp FILTER tests/* moc_*.cpp)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# enable QML debugging
if(CMAKE_BUILD_TYPE MATCHES DEBUG OR CMAKE_BUILD_TYPE MATCHES "Debug")
add_definitions(-DQT_QML_DEBUG)
endif()
include(qt5)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(DESKTOP_FILE morph-browser.desktop)
# uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
add_subdirectory(src)
enable_testing()
add_subdirectory(tests)
# make non compiled files (QML, JS, images, etc.) visible in QtCreator
file(GLOB NON_COMPILED_ROOT *.png .bzrignore COPYING README snapcraft.yaml)
file(GLOB_RECURSE NON_COMPILED_SUBDIRS
debian/*.dirs debian/*.install debian/*.lintian-overrides debian/*.manifest
debian/compat debian/control debian/copyright debian/rules debian/source/format
debian/tests/*
doc/*.css doc/*.qdoc doc/*.qdocconf
po/*.po po/*.pot
snap/morph-browser.launcher
src/*.js src/*.qml src/*.sci src/README
tests/*.py tests/*.qml)
add_custom_target(NON_COMPILED_TARGET ALL SOURCES ${NON_COMPILED_ROOT} ${NON_COMPILED_SUBDIRS})
# for dh_translations to extract the domain
# (regarding syntax consistency, see http://pad.lv/1181187)
set (GETTEXT_PACKAGE "morph-browser")
add_subdirectory(po)
add_subdirectory(doc)
install(FILES morph-browser.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/morph-browser)
install(FILES morph-browser-splash.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/morph-browser)
add_subdirectory(click-hooks)