-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
91 lines (76 loc) · 2.46 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
project(places CXX C)
cmake_minimum_required(VERSION 2.8.10)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
include("QtCreatorResources")
qtcreator_add_project_resources(
"places.secret"
"readme.md"
"manifest.json.in"
"places.apparmor"
)
# We require g++ 4.9, to avoid ABI breakage with earlier version.
set(cxx_version_required 4.9)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (NOT CMAKE_CXX_COMPILER_VERSION MATCHES "^${cxx_version_required}")
message(FATAL_ERROR "g++ version must be ${cxx_version_required}!")
endif()
endif()
# Set strict and naggy C++ compiler flags, and enable C++11
add_definitions(
-fno-permissive
-std=c++11
-pedantic
-Wall
-Wextra
-fPIC
-DQT_NO_KEYWORDS
)
include(GNUInstallDirs)
find_package(PkgConfig)
# We depend on Boost for string trimming
find_package(
Boost
REQUIRED
)
# Search for our dependencies
pkg_check_modules(
SCOPE
libunity-scopes>=0.6.0
jsoncpp
net-cpp>=1.1.0
REQUIRED
)
# Add our dependencies to the include paths
include_directories(
"${CMAKE_SOURCE_DIR}/include"
${Boost_INCLUDE_DIRS}
${SCOPE_INCLUDE_DIRS}
)
# Do not remove this line, its required for the correct functionality of the Ubuntu-SDK
set(UBUNTU_MANIFEST_PATH "manifest.json.in" CACHE INTERNAL "Tells QtCreator location and name of the manifest file")
set(UBUNTU_PROJECT_TYPE "Scope" CACHE INTERNAL "Tells QtCreator this is a Scope project")
# Important project paths
set(CMAKE_INSTALL_PREFIX /)
set(SCOPE_INSTALL_DIR "/places")
set(GETTEXT_PACKAGE "places")
file(STRINGS places.secret SECRET_STRINGS)
list(GET SECRET_STRINGS 0 API_KEY)
# If we need to refer to the scope's name or package in code, these definitions will help
add_definitions(-DPACKAGE_NAME="com.ubuntu.developer.labsin.places")
add_definitions(-DSCOPE_NAME="com.ubuntu.developer.labsin.places_places")
add_definitions(-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}")
add_definitions(-DAPI_KEY="${API_KEY}")
#This command figures out the target architecture and puts it into the manifest file
execute_process(
COMMAND dpkg-architecture -qDEB_HOST_ARCH
OUTPUT_VARIABLE CLICK_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
# Install the click manifest
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json DESTINATION "/")
install(FILES "places.apparmor" DESTINATION "/")
# Add our main directories
add_subdirectory(src)
add_subdirectory(data)
add_subdirectory(po)