~neon/kactivities/master

381.1.1 by Ivan Čukić
Core library ported
1
# vim:set softtabstop=3 shiftwidth=3 tabstop=3 expandtab:
2
957 by Albert Astals Cid
GIT_SILENT Upgrade CMake version requirement to 3.5.
3
cmake_minimum_required(VERSION 3.5)
381.1.1 by Ivan Čukić
Core library ported
4
873 by Sven Brauch
Fix build with CMP0048 set to NEW
5
# KDE Frameworks
980 by l10n daemon script
GIT_SILENT Upgrade KF5 version to 5.60.0.
6
set(KF5_VERSION "5.60.0") # handled by release scripts
978 by l10n daemon script
GIT_SILENT Upgrade ECM and KF5 version requirements for 5.59.0 release.
7
set(KF5_DEP_VERSION "5.59.0") # handled by release scripts
873 by Sven Brauch
Fix build with CMP0048 set to NEW
8
project (KActivities VERSION ${KF5_VERSION})
282 by Ivan Čukić
Refactor to follow the project's filename and cmake style
9
810 by Ivan Čukić
Building only the library by default
10
option (KACTIVITIES_LIBRARY_ONLY "If true, compiles only the KActivities library, without the QML imports." OFF)
604 by Ivan Čukić
Adding the option to install the experimental library (default: off)
11
option (KACTIVITIES_ENABLE_EXCEPTIONS "If you have Boost 1.53, you need to build KActivities with exceptions enabled. This is UNTESTED and EXPERIMENTAL!" OFF)
12
963 by Albert Astals Cid
GIT_SILENT Upgrade Qt5 version requirement to 5.10.0.
13
set (REQUIRED_QT_VERSION 5.10.0)
381.1.19 by Marco Martin
adjust cmake stuff so that is possible to link
14
381.1.1 by Ivan Čukić
Core library ported
15
# We don't build in-source
16
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
17
   message (
18
      FATAL_ERROR
979 by David Faure
GIT_SILENT Fix comment in fatal error, this isn't plasma
19
      "kactivities require an out of source build. Please create a separate build directory and run 'cmake path_to_sources [options]' there."
381.1.1 by Ivan Čukić
Core library ported
20
   )
21
endif ()
22
578 by Ivan Čukić
Use KACTIVITIES_CURRENT_ROOT_SOURCE_DIR instead of CMAKE_SOURCE_DIR
23
set (KACTIVITIES_CURRENT_ROOT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
24
381.1.1 by Ivan Čukić
Core library ported
25
# Extra CMake stuff
660 by Jeremy Whiting
Add verbose ecm message when ECM isn't found.
26
include(FeatureSummary)
978 by l10n daemon script
GIT_SILENT Upgrade ECM and KF5 version requirements for 5.59.0 release.
27
find_package(ECM 5.59.0  NO_MODULE)
660 by Jeremy Whiting
Add verbose ecm message when ECM isn't found.
28
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules")
29
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
30
381.1.36 by Stephen Kelly
Find the new KF5Config file, not the old FindKF5 file.
31
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
381.1.1 by Ivan Čukić
Core library ported
32
550 by Ivan Čukić
Unified CMakeLists files formatting
33
include (KDEInstallDirs)
34
include (KDECMakeSettings)
946 by Laurent Montel
USe directly KDEFrameworkCompilerSettings
35
include (KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
550 by Ivan Čukić
Unified CMakeLists files formatting
36
include (GenerateExportHeader)
37
include (ECMGenerateHeaders)
948 by Laurent Montel
Autogenerate debug categories + add categories file
38
include (ECMQtDeclareLoggingCategory)
896 by Friedrich W. H. Kossebau
[FEATURE] Option to build & install QCH file with the public API dox
39
include (ECMAddQch)
964 by Yurii Kolesnykov
fix for macOS
40
include (ECMMarkNonGuiExecutable)
896 by Friedrich W. H. Kossebau
[FEATURE] Option to build & install QCH file with the public API dox
41
42
option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF)
43
add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)")
381.1.18 by Marco Martin
add some cmake stuff to link to kactivities
44
381.1.1 by Ivan Čukić
Core library ported
45
# Qt
46
set (CMAKE_AUTOMOC ON)
694 by David Faure
actually use REQUIRED_QT_VERSION
47
find_package (Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED COMPONENTS Core DBus)
381.1.1 by Ivan Čukić
Core library ported
48
381.1.18 by Marco Martin
add some cmake stuff to link to kactivities
49
# Basic includes
50
include (CPack)
660 by Jeremy Whiting
Add verbose ecm message when ECM isn't found.
51
874 by Sven Brauch
GIT_SILENT Fix ECM warning: use CMakePackageConfigHelpers instead of ECM variant
52
include (CMakePackageConfigHelpers)
381.1.18 by Marco Martin
add some cmake stuff to link to kactivities
53
include (ECMSetupVersion)
54
837 by Ivan Čukić
Fixing warnings reported by clang analyzer
55
message ("We are using the ${CMAKE_CXX_COMPILER_ID} compiler")
56
if ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (KACTIVITIES_OVERRIDE_VISIBILITY STREQUAL "default"))
57
   message ("Setting visibility preset to default")
665 by Ivan Čukić
Clang seems not to handle fvisibility correctly
58
   set(CMAKE_CXX_VISIBILITY_PRESET default)
59
   set(CMAKE_VISIBILITY_INLINES_HIDDEN 0)
837 by Ivan Čukić
Fixing warnings reported by clang analyzer
60
   string (REPLACE "-fvisibility-inlines-hidden" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
61
   string (REPLACE "-fvisibility=hidden" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
665 by Ivan Čukić
Clang seems not to handle fvisibility correctly
62
endif ()
63
592 by Ivan Čukić
Fixing the CMake problems with the new stats library
64
# libKActivities
65
550 by Ivan Čukić
Unified CMakeLists files formatting
66
ecm_setup_version (
873 by Sven Brauch
Fix build with CMP0048 set to NEW
67
   PROJECT
550 by Ivan Čukić
Unified CMakeLists files formatting
68
   VARIABLE_PREFIX KACTIVITIES
69
   VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kactivities_version.h"
70
   PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5ActivitiesConfigVersion.cmake"
71
   SOVERSION 5
72
   )
73
969 by Laurent Montel
GIT_SILENT: this module compiles fine without deprecated methods
74
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000)
972 by Laurent Montel
[kactivities] compile without foreach
75
add_definitions(-DQT_NO_FOREACH)
944 by Laurent Montel
Make compile with strict compile flags
76
896 by Friedrich W. H. Kossebau
[FEATURE] Option to build & install QCH file with the public API dox
77
add_subdirectory (src)
937 by Antonio Rojas
Honor BUILD_TESTING
78
if (BUILD_TESTING)
79
    add_subdirectory (autotests)
80
    add_subdirectory (tests)
81
endif()
896 by Friedrich W. H. Kossebau
[FEATURE] Option to build & install QCH file with the public API dox
82
553 by Alex Merry
Update installation variables.
83
set (CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Activities")
381.1.58 by David Faure
Make kactivities more consistent with the other frameworks
84
896 by Friedrich W. H. Kossebau
[FEATURE] Option to build & install QCH file with the public API dox
85
if (BUILD_QCH)
86
    ecm_install_qch_export(
87
        TARGETS KF5Activities_QCH
88
        FILE KF5ActivitiesLibraryQchTargets.cmake
89
        DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
90
        COMPONENT Devel
91
    )
92
    set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KF5ActivitiesLibraryQchTargets.cmake\")")
93
endif()
94
550 by Ivan Čukić
Unified CMakeLists files formatting
95
install (
96
   EXPORT KF5ActivitiesLibraryTargets
381.1.58 by David Faure
Make kactivities more consistent with the other frameworks
97
   DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
98
   FILE KF5ActivitiesLibraryTargets.cmake
99
   NAMESPACE KF5::
100
   )
101
874 by Sven Brauch
GIT_SILENT Fix ECM warning: use CMakePackageConfigHelpers instead of ECM variant
102
configure_package_config_file (
550 by Ivan Čukić
Unified CMakeLists files formatting
103
   "${CMAKE_CURRENT_SOURCE_DIR}/KF5ActivitiesConfig.cmake.in"
381.1.58 by David Faure
Make kactivities more consistent with the other frameworks
104
   "${CMAKE_CURRENT_BINARY_DIR}/KF5ActivitiesConfig.cmake"
550 by Ivan Čukić
Unified CMakeLists files formatting
105
   INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
106
   PATH_VARS  KF5_INCLUDE_INSTALL_DIR CMAKE_INSTALL_PREFIX
107
   )
108
109
install (
110
   FILES "${CMAKE_CURRENT_BINARY_DIR}/KF5ActivitiesConfig.cmake"
111
         "${CMAKE_CURRENT_BINARY_DIR}/KF5ActivitiesConfigVersion.cmake"
112
   DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
113
   COMPONENT Devel
114
   )
115
116
install (
117
   FILES ${CMAKE_CURRENT_BINARY_DIR}/kactivities_version.h
553 by Alex Merry
Update installation variables.
118
   DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel
550 by Ivan Čukić
Unified CMakeLists files formatting
119
   )
381.1.58 by David Faure
Make kactivities more consistent with the other frameworks
120
948 by Laurent Montel
Autogenerate debug categories + add categories file
121
install( FILES kactivities.categories DESTINATION ${KDE_INSTALL_CONFDIR} )
122
381.1.1 by Ivan Čukić
Core library ported
123
# Write out the features
381.1.7 by Ivan Čukić
Sqlite plugin ported
124
feature_summary (WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
381.1.1 by Ivan Čukić
Core library ported
125