Warning, /pim/kldap/cmake/FindLdap.cmake is written in an unsupported language. File is not indexed.
0001 #.rst: 0002 # FindLdap 0003 # -------- 0004 # 0005 # Try to find the LDAP client libraries. 0006 # 0007 # This will define the following variables: 0008 # 0009 # ``Ldap_FOUND`` 0010 # True if libldap is available. 0011 # 0012 # ``Ldap_VERSION`` 0013 # The version of libldap 0014 # 0015 # ``Ldap_INCLUDE_DIRS`` 0016 # This should be passed to target_include_directories() if 0017 # the target is not used for linking 0018 # 0019 # ``Ldap_LIBRARIES`` 0020 # The LDAP libraries (libldap + liblber if available) 0021 # This can be passed to target_link_libraries() instead of 0022 # the ``Ldap::Ldap`` target 0023 # 0024 # If ``Ldap_FOUND`` is TRUE, the following imported target 0025 # will be available: 0026 # 0027 # ``Ldap::Ldap`` 0028 # The LDAP library 0029 # 0030 # Since pre-5.0.0. 0031 # 0032 # Imported target since 5.1.41 0033 # 0034 #============================================================================= 0035 # SPDX-FileCopyrightText: 2006 Szombathelyi György <gyurco@freemail.hu> 0036 # SPDX-FileCopyrightText: 2007-2024 Laurent Montel <montel@kde.org> 0037 # 0038 # SPDX-License-Identifier: BSD-3-Clause 0039 #============================================================================= 0040 0041 find_path(Ldap_INCLUDE_DIRS NAMES ldap.h) 0042 0043 if(APPLE) 0044 find_library(Ldap_LIBRARIES NAMES LDAP 0045 PATHS 0046 /System/Library/Frameworks 0047 /Library/Frameworks 0048 ) 0049 else() 0050 find_library(Ldap_LIBRARY NAMES ldap) 0051 find_library(Lber_LIBRARY NAMES lber) 0052 endif() 0053 0054 if(Ldap_LIBRARY AND Lber_LIBRARY) 0055 set(Ldap_LIBRARIES ${Ldap_LIBRARY} ${Lber_LIBRARY}) 0056 endif() 0057 0058 if(EXISTS ${Ldap_INCLUDE_DIRS}/ldap_features.h) 0059 file(READ ${Ldap_INCLUDE_DIRS}/ldap_features.h LDAP_FEATURES_H_CONTENT) 0060 string(REGEX MATCH "#define LDAP_VENDOR_VERSION_MAJOR[ ]+[0-9]+" _LDAP_VERSION_MAJOR_MATCH ${LDAP_FEATURES_H_CONTENT}) 0061 string(REGEX MATCH "#define LDAP_VENDOR_VERSION_MINOR[ ]+[0-9]+" _LDAP_VERSION_MINOR_MATCH ${LDAP_FEATURES_H_CONTENT}) 0062 string(REGEX MATCH "#define LDAP_VENDOR_VERSION_PATCH[ ]+[0-9]+" _LDAP_VERSION_PATCH_MATCH ${LDAP_FEATURES_H_CONTENT}) 0063 0064 string(REGEX REPLACE ".*_MAJOR[ ]+(.*)" "\\1" LDAP_VERSION_MAJOR ${_LDAP_VERSION_MAJOR_MATCH}) 0065 string(REGEX REPLACE ".*_MINOR[ ]+(.*)" "\\1" LDAP_VERSION_MINOR ${_LDAP_VERSION_MINOR_MATCH}) 0066 string(REGEX REPLACE ".*_PATCH[ ]+(.*)" "\\1" LDAP_VERSION_PATCH ${_LDAP_VERSION_PATCH_MATCH}) 0067 0068 set(Ldap_VERSION "${LDAP_VERSION_MAJOR}.${LDAP_VERSION_MINOR}.${LDAP_VERSION_PATCH}") 0069 endif() 0070 0071 include(FindPackageHandleStandardArgs) 0072 0073 find_package_handle_standard_args(Ldap 0074 FOUND_VAR Ldap_FOUND 0075 REQUIRED_VARS Ldap_LIBRARIES Ldap_INCLUDE_DIRS 0076 VERSION_VAR Ldap_VERSION 0077 ) 0078 0079 if(Ldap_FOUND AND NOT TARGET Lber::Lber) 0080 add_library(Lber::Lber UNKNOWN IMPORTED) 0081 set_target_properties(Lber::Lber PROPERTIES 0082 IMPORTED_LOCATION "${Lber_LIBRARY}") 0083 endif() 0084 0085 if(Ldap_FOUND AND NOT TARGET Ldap::Ldap) 0086 add_library(Ldap::Ldap UNKNOWN IMPORTED) 0087 set_target_properties(Ldap::Ldap PROPERTIES 0088 IMPORTED_LOCATION "${Ldap_LIBRARY}" 0089 INTERFACE_INCLUDE_DIRECTORIES "${Ldap_INCLUDE_DIRS}" 0090 INTERFACE_LINK_LIBRARIES Lber::Lber) 0091 endif() 0092 0093 mark_as_advanced(Ldap_INCLUDE_DIRS Ldap_LIBRARY Lber_LIBRARY Ldap_LIBRARIES) 0094 0095 include(FeatureSummary) 0096 set_package_properties(Ldap PROPERTIES 0097 URL "https://www.openldap.org/" 0098 DESCRIPTION "LDAP (Lightweight Directory Access Protocol) libraries." 0099 )