summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindOpenLDAP.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /cmake/modules/FindOpenLDAP.cmake
parentInitial commit. (diff)
downloadceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz
ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip
Adding upstream version 18.2.2.upstream/18.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/modules/FindOpenLDAP.cmake')
-rw-r--r--cmake/modules/FindOpenLDAP.cmake41
1 files changed, 41 insertions, 0 deletions
diff --git a/cmake/modules/FindOpenLDAP.cmake b/cmake/modules/FindOpenLDAP.cmake
new file mode 100644
index 000000000..09bb49c62
--- /dev/null
+++ b/cmake/modules/FindOpenLDAP.cmake
@@ -0,0 +1,41 @@
+# - Find OpenLDAP C Libraries
+#
+# OpenLDAP_FOUND - True if found.
+# OpenLDAP_INCLUDE_DIR - Path to the openldap include directory
+# OpenLDAP_LIBRARIES - Paths to the ldap and lber libraries
+
+find_path(OpenLDAP_INCLUDE_DIR ldap.h PATHS
+ /usr/include
+ /opt/local/include
+ /usr/local/include)
+
+find_library(LDAP_LIBRARY ldap)
+find_library(LBER_LIBRARY lber)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(OpenLDAP DEFAULT_MSG
+ OpenLDAP_INCLUDE_DIR LDAP_LIBRARY LBER_LIBRARY)
+
+mark_as_advanced(
+ OpenLDAP_INCLUDE_DIR LDAP_LIBRARY LBER_LIBRARY)
+
+if(OpenLDAP_FOUND)
+ set(OpenLDAP_LIBRARIES ${LDAP_LIBRARY} ${LBER_LIBRARY})
+ if(NOT TARGET OpenLDAP::OpenLDAP)
+ add_library(OpenLDAP::LDAP UNKNOWN IMPORTED)
+ set_target_properties(OpenLDAP::LDAP PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${OpenLDAP_INCLUDE_DIR}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${LDAP_LIBRARY}")
+ add_library(OpenLDAP::BER UNKNOWN IMPORTED)
+ set_target_properties(OpenLDAP::BER PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${OpenLDAP_INCLUDE_DIR}"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${LBER_LIBRARY}")
+ add_library(openldap INTERFACE)
+ target_link_libraries(openldap INTERFACE
+ OpenLDAP::LDAP
+ OpenLDAP::BER)
+ add_library(OpenLDAP::OpenLDAP ALIAS openldap)
+ endif()
+endif()