CMakeLists.txt 2.24 KB
Newer Older
1
# 3.1 is required for `target_sources`.
Daan De Meyer's avatar
Daan De Meyer committed
2
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
Hannah von Reth's avatar
Hannah von Reth committed
3

Daan De Meyer's avatar
Daan De Meyer committed
4
# KDE Applications version, managed by release script.
5
6
set(RELEASE_SERVICE_VERSION_MAJOR "21")
set(RELEASE_SERVICE_VERSION_MINOR "03")
7
8
set(RELEASE_SERVICE_VERSION_MICRO "70")
set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
9

10
project(kate VERSION ${RELEASE_SERVICE_VERSION})
Albert Astals Cid's avatar
Albert Astals Cid committed
11

12
set(QT_MIN_VERSION "5.10.0")
Nicolas Fella's avatar
Nicolas Fella committed
13
set(KF5_DEP_VERSION "5.68.0")
Albert Astals Cid's avatar
Albert Astals Cid committed
14

Daan De Meyer's avatar
Daan De Meyer committed
15
16
# We need some parts of the ECM CMake helpers.
find_package(ECM ${KF5_DEP_VERSION} QUIET REQUIRED NO_MODULE)
Andreas Sturmlechner's avatar
Andreas Sturmlechner committed
17

Yuri Chornoivan's avatar
Yuri Chornoivan committed
18
# We append to the module path so modules can be overridden from the command line.
Daan De Meyer's avatar
Daan De Meyer committed
19
list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
20

21
# Allow adding Qt resource files with `add_executable` or `target_sources` instead of
22
23
24
# `qt5_add_resources`. See https://cmake.org/cmake/help/v3.0/manual/cmake-qt.7.html#autorcc.
set(CMAKE_AUTORCC ON)

Daan De Meyer's avatar
Daan De Meyer committed
25
26
27
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(KDEInstallDirs)
include(KDECMakeSettings)
28

Daan De Meyer's avatar
Daan De Meyer committed
29
30
31
include(ECMOptionalAddSubdirectory)
include(ECMAddAppIcon)
include(ECMInstallIcons)
32

Daan De Meyer's avatar
Daan De Meyer committed
33
include(FeatureSummary)
34

35
36
# forbid some old things
add_definitions(-DQT_NO_FOREACH)
37

38
39
40
# Required here so that the version comparison below works
find_package(Qt5Widgets ${QT_MIN_VERSION} CONFIG REQUIRED)

41
42
# Required here so that the ki18n_install/kdoctools_install calls injected by
# the release scripts work.
43
find_package(KF5 ${KF5_DEP_VERSION}
44
45
46
47
48
49
    REQUIRED COMPONENTS
        I18n
    OPTIONAL_COMPONENTS
        DocTools
)

50
# Qt 5.13 deprecated QComboBox::currentIndexChanged(QString) and Qt 5.14 undid that...
51
if (NOT Qt5Widgets_VERSION VERSION_LESS 5.14.0)
52
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050d00)
53
endif()
54

Daan De Meyer's avatar
Daan De Meyer committed
55
56
57
58
ecm_optional_add_subdirectory(addons)
ecm_optional_add_subdirectory(kwrite)
ecm_optional_add_subdirectory(kate)
ecm_optional_add_subdirectory(doc)
59

Daan De Meyer's avatar
Daan De Meyer committed
60
feature_summary(INCLUDE_QUIET_PACKAGES WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
61
62
63
64
65
66
67
68
69

# this needs at least ECM 5.64...
if(${ECM_VERSION} VERSION_GREATER "5.63.0")
    include(KDEClangFormat)

    # add clang-format target for all our real source files
    file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
    kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
endif()