forked from ubports/address-book-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
98 lines (82 loc) · 3.13 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
98
project(address-book-app)
cmake_minimum_required(VERSION 2.8.9)
set(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)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DQT_QML_DEBUG")
# Standard install paths
include(GNUInstallDirs)
include(autopilot)
find_package(PkgConfig REQUIRED)
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Qml REQUIRED)
find_package(Qt5Quick REQUIRED)
find_package(Qt5DBus REQUIRED)
find_package(Qt5Test REQUIRED)
find_package(Qt5Contacts REQUIRED)
pkg_check_modules(QOfono REQUIRED qofono-qt5)
find_program(INTLTOOL_MERGE intltool-merge)
find_program(INTLTOOL_EXTRACT intltool-extract)
find_program(DBUS_RUNNER dbus-test-runner)
if(NOT INTLTOOL_MERGE)
message(FATAL_ERROR "intltool-merge not found. Try install intltool package;")
endif()
if(NOT INTLTOOL_EXTRACT)
message(FATAL_ERROR "intltool-extract not found. Try install intltool package;")
endif()
set(ADDRESS_BOOK_APP_DIR ${CMAKE_INSTALL_DATADIR}/address-book-app)
set(ADDRESS_BOOK_APP_FULL_DIR ${CMAKE_INSTALL_FULL_DATADIR}/address-book-app)
set(ADDRESS_BOOK_APP_NAME "Address Book")
set(DESKTOP_FILE address-book-app.desktop)
set(API_VERSION 0.1)
# for dh_translations to extract the domain
# (regarding syntax consistency, see http://pad.lv/1181187)
set(GETTEXT_PACKAGE "address-book-app")
option(INSTALL_TESTS "Install the tests on make install" on)
option(INSTALL_COMPONENTS "Install the Ubuntu contact components" on)
option(CLICK_MODE "Installs to a contained location" off)
option(USE_XVFB "Use XVFB to run qml tests" on)
# Tests
enable_testing()
# components PATH
if(CLICK_MODE)
set(QT_IMPORTS_DIR "${ADDRESS_BOOK_APP_DIR}/imports/")
else()
set(QT_IMPORTS_DIR "${CMAKE_INSTALL_LIBDIR}/qt5/qml")
endif()
if(CLICK_MODE)
set(CLICK_MODE_ENABLED 1)
set(CMAKE_INSTALL_PREFIX /)
set(CMAKE_INSTALL_BINDIR /)
set(CLICK_TAG click)
set(ADDRESS_BOOK_APP_BINDIR "./")
set(QT_EXTRA_IMPORTS_DIR ${QT_IMPORTS_DIR})
set(INSTALL_TESTS off)
else(CLICK_MODE)
set(CLICK_MODE_ENABLED 0)
set(ADDRESS_BOOK_APP_BINDIR "")
set(QT_EXTRA_IMPORTS_DIR "")
endif(CLICK_MODE)
set(DESKTOP_EXEC "address-book-app")
set(QMLPLUGIN_INSTALL_PREFIX "${QT_IMPORTS_DIR}/Ubuntu/Contacts.${API_VERSION}/")
set(ADDRESS_BOOK_QMLPLUGIN_INSTALL_PREFIX "${QT_IMPORTS_DIR}/Ubuntu/AddressBook/")
set(ADDRESS_BOOK_APP_DESKTOP_FILE address-book-app.desktop)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
add_subdirectory(data)
add_subdirectory(src)
add_subdirectory(po)
add_subdirectory(tests)
add_subdirectory(click)
# 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 "${CMAKE_COMMAND}"
-P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
# config file
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/config.h"
IMMEDIATE @ONLY)