CMakeLists.txt 1.89 KB
Newer Older
Marco Martin's avatar
Marco Martin committed
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
cmake_minimum_required(VERSION 3.0)

set(KF5_VERSION "5.47.0") # handled by release scripts
set(KF5_DEP_VERSION "5.47.0") # handled by release scripts

project(kirigami2gallery VERSION ${KF5_VERSION})

set(REQUIRED_QT_VERSION 5.8.0)

SET(CMAKE_CXX_STANDARD 11)

################# Disallow in-source build #################

if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
   message(FATAL_ERROR "kirigami gallery requires an out of source build. Please create a separate build directory and run 'cmake path_to_kirigami [options]' there.")
endif()

# Make CPack available to easy generate binary packages
include(CPack)
include(FeatureSummary)

find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Gui Svg QuickControls2)

set(CMAKE_AUTOMOC ON)
set(AUTOMOC_MOC_OPTIONS -Muri=org.kde.kirigami)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

################# set KDE specific information #################

find_package(ECM 5.47.0 NO_MODULE)
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules")

33
34
option(ENABLE_QML_PROFILING "Enable QML profiler support" ON)

Marco Martin's avatar
Marco Martin committed
35
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
36
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
Marco Martin's avatar
Marco Martin committed
37
38
39
40

include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
41
42
include(ECMPoQmTools)
include(ECMQMLModules)
Marco Martin's avatar
Marco Martin committed
43
44
45
46
47
48
49

if(CMAKE_SYSTEM_NAME STREQUAL "Android")
    find_package(Qt5AndroidExtras ${REQUIRED_QT_VERSION} REQUIRED)
endif()


ecm_find_qmlmodule(QtGraphicalEffects 1.0)
50
ecm_find_qmlmodule(org.kde.kitemmodels 1.0)
Marco Martin's avatar
Marco Martin committed
51
52
53
54
55
56
57
58
59
60
61

add_definitions(-DQT_NO_URL_CAST_FROM_STRING)

add_subdirectory(src)

if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po")
    ecm_install_po_files_as_qm(po)
endif()

feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)