CMakeLists.txt 4.41 KB
Newer Older
Laurent Montel's avatar
Laurent Montel committed
1
include(CheckFunctionExists)
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
2
include(CheckIncludeFiles)
Laurent Montel's avatar
Laurent Montel committed
3
4
5
6
7
8
include(CheckSymbolExists)

check_include_files(sys/time.h HAVE_SYS_TIME_H)

set(kldap_EXTRA_LIBS)

Laurent Montel's avatar
Laurent Montel committed
9
if(Ldap_FOUND)
10
  set(kldap_EXTRA_LIBS Ldap::Ldap)
Nicolás Alvarez's avatar
Nicolás Alvarez committed
11
12
13
  if(WIN32)
    set(kldap_EXTRA_LIBS ${kldap_EXTRA_LIBS} ws2_32)
  endif()
Laurent Montel's avatar
Laurent Montel committed
14
15
  set(HAVE_LDAP_H)
  set(CMAKE_REQUIRED_INCLUDES lber.h ldap.h)
16
  set(CMAKE_REQUIRED_LIBRARIES Ldap::Ldap)
Laurent Montel's avatar
Laurent Montel committed
17
18
19
20
21
22
23
24
25
26
  check_function_exists(ldap_start_tls_s HAVE_LDAP_START_TLS_S)
  check_function_exists(ldap_initialize HAVE_LDAP_INITIALIZE)
  check_function_exists(ber_memfree HAVE_BER_MEMFREE)
  check_function_exists(ldap_unbind_ext HAVE_LDAP_UNBIND_EXT)
  check_function_exists(ldap_extended_operation HAVE_LDAP_EXTENDED_OPERATION)
  check_function_exists(ldap_extended_operation_s HAVE_LDAP_EXTENDED_OPERATION_S)
  check_symbol_exists(ldap_extended_operation ldap.h HAVE_LDAP_EXTENDED_OPERATION_PROTOTYPE)
  check_symbol_exists(ldap_extended_operation_s ldap.h HAVE_LDAP_EXTENDED_OPERATION_S_PROTOTYPE)
endif()

27
set(kldap_EXTRA_LIBS ${kldap_EXTRA_LIBS} Sasl2::Sasl2)
Laurent Montel's avatar
Laurent Montel committed
28

Laurent Montel's avatar
Minor    
Laurent Montel committed
29
configure_file(kldap_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kldap_config.h)
Laurent Montel's avatar
Laurent Montel committed
30
31
32

########### next target ###############

33
34
35
36
37
38
39
40
41
42
43
set(kldap_LIB_core_SRCS
  core/ber.cpp
  core/ldif.cpp
  core/ldapurl.cpp
  core/ldapserver.cpp
  core/ldapobject.cpp
  core/ldapconnection.cpp
  core/ldapoperation.cpp
  core/ldapcontrol.cpp
  core/ldapsearch.cpp
  core/ldapdn.cpp
Laurent Montel's avatar
Laurent Montel committed
44
)
45
46
47
48
49
50
51
52

set(kldap_LIB_widgets_SRCS
  widgets/ldapconfigwidget.cpp
  widgets/addhostdialog.cpp
  widgets/ldapclient.cpp
  widgets/ldapclientsearch.cpp
  widgets/ldapclientsearchconfig.cpp
  widgets/ldapconfigurewidget.cpp
Laurent Montel's avatar
Laurent Montel committed
53
  widgets/ldapclientsearchconfigreadconfigjob.cpp
54
  widgets/ldapclientsearchconfigwriteconfigjob.cpp
Laurent Montel's avatar
Laurent Montel committed
55
  widgets/ldapwidgetitem_p.cpp
56
  widgets/ldapwidgetitemreadconfigserverjob.cpp
Laurent Montel's avatar
Laurent Montel committed
57
  widgets/ldapsearchclientreadconfigserverjob.cpp
58
59
60
61
62
63
64
 )
 
 set(kldap_LIB_SRCS
      ${kldap_LIB_core_SRCS}
      ${kldap_LIB_widgets_SRCS}
      )
 
65
ecm_qt_declare_logging_category(kldap_LIB_SRCS HEADER ldap_debug.h IDENTIFIER LDAP_LOG CATEGORY_NAME org.kde.pim.ldap
Laurent Montel's avatar
Laurent Montel committed
66
67
68
69
70
        DESCRIPTION "kldaplib (kldap)"
        OLD_CATEGORY_NAMES log_ldap
        EXPORT KLDAP
    )

71
72
73
74
75
76
ecm_qt_declare_logging_category(kldap_LIB_SRCS HEADER ldapclient_debug.h IDENTIFIER LDAPCLIENT_LOG CATEGORY_NAME org.kde.pim.ldapclient
        DESCRIPTION "ldapclient (libkdepim)"
        OLD_CATEGORY_NAMES log_ldapclient
        EXPORT KLDAP
    )

Laurent Montel's avatar
Laurent Montel committed
77

Laurent Montel's avatar
Laurent Montel committed
78

79
add_library(KF5Ldap ${kldap_LIB_SRCS})
80
81
82
if (COMPILE_WITH_CMAKE_SUPPORT)
    set_target_properties(KF5Ldap PROPERTIES UNITY_BUILD ON)
endif()
83
generate_export_header(KF5Ldap BASE_NAME kldap)
Laurent Montel's avatar
Laurent Montel committed
84

85
add_library(KF5::Ldap ALIAS KF5Ldap)
Laurent Montel's avatar
Laurent Montel committed
86

87
target_link_libraries(KF5Ldap
Laurent Montel's avatar
Laurent Montel committed
88
PRIVATE
Laurent Montel's avatar
Laurent Montel committed
89
90
91
  Qt5::Widgets
  KF5::I18n
  KF5::WidgetsAddons
92
93
  KF5::ConfigCore
  KF5::CoreAddons
Laurent Montel's avatar
Laurent Montel committed
94
  KF5::KIOCore
Laurent Montel's avatar
Laurent Montel committed
95
  ${kldap_EXTRA_LIBS}
Laurent Montel's avatar
Laurent Montel committed
96
  qt5keychain
Laurent Montel's avatar
Laurent Montel committed
97
98
)

99
target_include_directories(KF5Ldap INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/KLDAP>")
100
target_include_directories(KF5Ldap PUBLIC "$<BUILD_INTERFACE:${KLdap_SOURCE_DIR}/src/core;${KLdap_BINARY_DIR}/src/core>")
Laurent Montel's avatar
Laurent Montel committed
101

102
set_target_properties(KF5Ldap PROPERTIES
Laurent Montel's avatar
Laurent Montel committed
103
104
    VERSION ${KLDAP_VERSION_STRING}
    SOVERSION ${KLDAP_SOVERSION}
Laurent Montel's avatar
Laurent Montel committed
105
    EXPORT_NAME Ldap
Laurent Montel's avatar
Laurent Montel committed
106
107
)

108
install(TARGETS KF5Ldap EXPORT KF5LdapTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
Laurent Montel's avatar
Laurent Montel committed
109
110
111

########### install files ###############

112
ecm_generate_headers(KLdapCore_CamelCase_HEADERS
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
113
114
115
116
117
118
119
120
121
  HEADER_NAMES
  Ber
  LdapConnection
  LdapControl
  LdapDN
  LdapObject
  LdapOperation
  LdapSearch
  LdapServer
Laurent Montel's avatar
Laurent Montel committed
122
  LdapDefs
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
123
124
  LdapUrl
  Ldif
125
126
127
128
129
130
131
132
133
134
135
136
137
  RELATIVE core
  PREFIX KLDAP
  REQUIRED_HEADERS KLdapCore_HEADERS
)

ecm_generate_headers(KLdapWidgets_CamelCase_HEADERS
  HEADER_NAMES
  LdapConfigWidget
  LdapClientSearchConfig
  LdapClientSearch
  AddHostDialog
  LdapClient
  LdapConfigureWidget
138
139
  LdapClientSearchConfigWriteConfigJob
  LdapClientSearchConfigReadConfigJob
140
  LdapSearchClientReadConfigServerJob
141
  RELATIVE widgets
142
  PREFIX KLDAP
143
  REQUIRED_HEADERS KLdapWidgets_HEADERS
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
144
145
146
)

install(FILES
147
    ${CMAKE_CURRENT_BINARY_DIR}/kldap_export.h
148
149
    ${KLdapCore_HEADERS}
    ${KLdapWidgets_HEADERS}
150
    DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KLDAP/kldap
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
151
152
153
    COMPONENT Devel
)

154
install(FILES
155
156
    ${KLdapCore_CamelCase_HEADERS}
    ${KLdapWidgets_CamelCase_HEADERS}
157
    DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KLDAP/KLDAP/
158
159
160
    COMPONENT Devel
)

161
ecm_generate_pri_file(BASE_NAME Ldap LIB_NAME KF5Ldap FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/KLDAP/)
Laurent Montel's avatar
Laurent Montel committed
162
163
install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})