CMakeLists.txt 4.04 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
55
56
57
58
59
60
 )
 
 set(kldap_LIB_SRCS
      ${kldap_LIB_core_SRCS}
      ${kldap_LIB_widgets_SRCS}
      )
 
61
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
62
63
64
65
66
        DESCRIPTION "kldaplib (kldap)"
        OLD_CATEGORY_NAMES log_ldap
        EXPORT KLDAP
    )

67
68
69
70
71
72
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
73

Laurent Montel's avatar
Laurent Montel committed
74

75
add_library(KF5Ldap ${kldap_LIB_SRCS})
Laurent Montel's avatar
Laurent Montel committed
76

77
generate_export_header(KF5Ldap BASE_NAME kldap)
Laurent Montel's avatar
Laurent Montel committed
78

79
add_library(KF5::Ldap ALIAS KF5Ldap)
Laurent Montel's avatar
Laurent Montel committed
80

81
target_link_libraries(KF5Ldap
Laurent Montel's avatar
Laurent Montel committed
82
PRIVATE
Laurent Montel's avatar
Laurent Montel committed
83
84
85
  Qt5::Widgets
  KF5::I18n
  KF5::WidgetsAddons
86
87
88
  KF5::ConfigCore
  KF5::Wallet
  KF5::CoreAddons
Laurent Montel's avatar
Laurent Montel committed
89
  KF5::KIOCore
Laurent Montel's avatar
Laurent Montel committed
90
  ${kldap_EXTRA_LIBS}
Laurent Montel's avatar
Laurent Montel committed
91
  qt5keychain
Laurent Montel's avatar
Laurent Montel committed
92
93
)

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

97
set_target_properties(KF5Ldap PROPERTIES
Laurent Montel's avatar
Laurent Montel committed
98
99
    VERSION ${KLDAP_VERSION_STRING}
    SOVERSION ${KLDAP_SOVERSION}
Laurent Montel's avatar
Laurent Montel committed
100
    EXPORT_NAME Ldap
Laurent Montel's avatar
Laurent Montel committed
101
102
)

103
install(TARGETS KF5Ldap EXPORT KF5LdapTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
Laurent Montel's avatar
Laurent Montel committed
104
105
106

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

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

ecm_generate_headers(KLdapWidgets_CamelCase_HEADERS
  HEADER_NAMES
  LdapConfigWidget
  LdapClientSearchConfig
  LdapClientSearch
  AddHostDialog
  LdapClient
  LdapConfigureWidget
  RELATIVE widgets
134
  PREFIX KLDAP
135
  REQUIRED_HEADERS KLdapWidgets_HEADERS
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
136
137
138
)

install(FILES
139
    ${CMAKE_CURRENT_BINARY_DIR}/kldap_export.h
140
141
    ${KLdapCore_HEADERS}
    ${KLdapWidgets_HEADERS}
142
    DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KLDAP/kldap
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
143
144
145
    COMPONENT Devel
)

146
install(FILES
147
148
    ${KLdapCore_CamelCase_HEADERS}
    ${KLdapWidgets_CamelCase_HEADERS}
149
    DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/KLDAP/KLDAP/
150
151
152
    COMPONENT Devel
)

153
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
154
155
install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})