CMakeLists.txt 3.47 KB
Newer Older
1
cmake_minimum_required(VERSION 3.5)
Laurent Montel's avatar
Laurent Montel committed
2
set(PIM_VERSION "5.16.40")
David Faure's avatar
David Faure committed
3

4
project(KLdap VERSION ${PIM_VERSION})
Àlex Fiestas's avatar
Àlex Fiestas committed
5

Laurent Montel's avatar
Laurent Montel committed
6
# ECM setup
7
set(KF5_MIN_VERSION "5.75.0")
Laurent Montel's avatar
Laurent Montel committed
8

9
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
10
set(CMAKE_MODULE_PATH ${KLdap_SOURCE_DIR}/cmake ${ECM_MODULE_PATH})
11

12
13
14
15
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)

Laurent Montel's avatar
Laurent Montel committed
16
17
18
include(GenerateExportHeader)
include(ECMGenerateHeaders)
include(ECMGeneratePriFile)
19

Laurent Montel's avatar
Laurent Montel committed
20
21
include(ECMSetupVersion)
include(FeatureSummary)
Laurent Montel's avatar
Laurent Montel committed
22
include(ECMQtDeclareLoggingCategory)
23

24
25
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Laurent Montel's avatar
Laurent Montel committed
26

Laurent Montel's avatar
Laurent Montel committed
27
set(KLDAP_LIB_VERSION ${PIM_VERSION})
Laurent Montel's avatar
Laurent Montel committed
28

29
30
find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED)
31
find_package(KF5DocTools ${KF5_MIN_VERSION} CONFIG)
32
33
34
find_package(KF5Wallet ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG REQUIRED)

35
36
37
38
39
40
#it will replace kwallet support
find_package(Qt5Keychain CONFIG)
set_package_properties(Qt5Keychain PROPERTIES
                                   DESCRIPTION "Provides support for secure credentials storage"
                                   URL "https://github.com/frankosterfeld/qtkeychain"
                                   TYPE OPTIONAL)
41

42
43
44
45
# tell what is missing without doctools
set_package_properties(KF5DocTools PROPERTIES DESCRIPTION "Provides tools to generate documentation in various format from DocBook files"
                       TYPE OPTIONAL
                       PURPOSE "Required to build documentation")
46

47
ecm_setup_version(PROJECT VARIABLE_PREFIX KLDAP
Laurent Montel's avatar
Laurent Montel committed
48
                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kldap_version.h"
49
                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5LdapConfigVersion.cmake"
Laurent Montel's avatar
Laurent Montel committed
50
                        SOVERSION 5
Allen Winter's avatar
cleanup    
Allen Winter committed
51
)
52

Laurent Montel's avatar
Laurent Montel committed
53
########### Find packages ###########
54
find_package(KF5WidgetsAddons ${KF5_MIN_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
55

Laurent Montel's avatar
Laurent Montel committed
56
add_definitions(-DQT_NO_FOREACH)
57
add_definitions(-DQT_NO_KEYWORDS)
58
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
59
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054C00)
60

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
61
62
63
64
65
66
67
find_package(Ldap)
set_package_properties(Ldap PROPERTIES
  TYPE RECOMMENDED
  PURPOSE "Needed to provide LDAP functionality in KDE"
)

find_package(Sasl2)
68
set_package_properties(Sasl2 PROPERTIES TYPE REQUIRED)
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
69

Laurent Montel's avatar
Laurent Montel committed
70
71
72
73
if (Ldap_FOUND)
   set(LDAP_FOUND 1)
endif()

74
add_definitions(-DTRANSLATION_DOMAIN=\"libkldap5\")
75

Laurent Montel's avatar
Laurent Montel committed
76

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
77
########### CMake Config Files ###########
78
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Ldap")
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
79

Laurent Montel's avatar
Laurent Montel committed
80
configure_package_config_file(
81
82
  "${CMAKE_CURRENT_SOURCE_DIR}/KF5LdapConfig.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5LdapConfig.cmake"
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
83
84
  INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
)
85

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
86
install(FILES
87
88
  "${CMAKE_CURRENT_BINARY_DIR}/KF5LdapConfig.cmake"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5LdapConfigVersion.cmake"
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
89
90
91
92
  DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
  COMPONENT Devel
)

93
install(EXPORT KF5LdapTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5LdapTargets.cmake NAMESPACE KF5::)
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
94
95
96

install(FILES
   ${CMAKE_CURRENT_BINARY_DIR}/kldap_version.h
97
   DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
98
99
100
101
   COMPONENT Devel
)

########### Targets ###########
Laurent Montel's avatar
Laurent Montel committed
102
add_subdirectory(src)
Laurent Montel's avatar
Laurent Montel committed
103
add_subdirectory(kioslave)
104
105
if(BUILD_TESTING)
    add_subdirectory(autotests)
106
    add_subdirectory(tests)
107
endif()
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
108

109
ecm_qt_install_logging_categories(
Laurent Montel's avatar
Laurent Montel committed
110
111
112
113
        EXPORT KLDAP
        FILE kldap.categories
        DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
        )
Laurent Montel's avatar
Laurent Montel committed
114

Laurent Montel's avatar
Laurent Montel committed
115
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)