summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindOpenLdap.cmake
diff options
context:
space:
mode:
authorKefu Chai <kchai@redhat.com>2016-07-21 19:28:21 +0200
committerKefu Chai <kchai@redhat.com>2016-07-25 09:39:01 +0200
commite21d98aed4ac18bbe0b4a3f29c4e6225cd787707 (patch)
treec9d9fc12833ebc703cbc2af5d2c9794f92dbc18b /cmake/modules/FindOpenLdap.cmake
parentcmake: cleanup Findtcmalloc.cmake (diff)
downloadceph-e21d98aed4ac18bbe0b4a3f29c4e6225cd787707.tar.xz
ceph-e21d98aed4ac18bbe0b4a3f29c4e6225cd787707.zip
cmake: cleanup FindOpenLdap.cmake
* use find_package_handle_standard_args() and remove unused bits. * rename OPENLDAP_LIBS to OPENLDAP_LIBRARIES, to be consistent with find_package() modules. Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'cmake/modules/FindOpenLdap.cmake')
-rw-r--r--cmake/modules/FindOpenLdap.cmake38
1 files changed, 11 insertions, 27 deletions
diff --git a/cmake/modules/FindOpenLdap.cmake b/cmake/modules/FindOpenLdap.cmake
index 42b3edd01d6..35b711d6b33 100644
--- a/cmake/modules/FindOpenLdap.cmake
+++ b/cmake/modules/FindOpenLdap.cmake
@@ -1,38 +1,22 @@
# - Find OpenLDAP C Libraries
#
-# OPENLDAP_PREFIX - where to find ldap.h and libraries
# OPENLDAP_FOUND - True if found.
+# OPENLDAP_INCLUDE_DIR - Path to the openldap include directory
+# OPENLDAP_LIBRARIES - Paths to the ldap and lber libraries
-set(OPENLDAP_LIB_DIR "${OPENLDAP_PREFIX}/lib")
-
-find_path(OPENLDAP_INCLUDE_DIR ldap.h NO_DEFAULT_PATH PATHS
+find_path(OPENLDAP_INCLUDE_DIR ldap.h PATHS
/usr/include
/opt/local/include
- /usr/local/include
- "${OPENLDAP_PREFIX}/include"
- )
-
-find_library(LIBLDAP NAMES ldap)
-find_library(LIBLBER NAMES lber)
+ /usr/local/include)
-if (OPENLDAP_INCLUDE_DIR AND LIBLDAP AND LIBLBER)
- set(OPENLDAP_FOUND TRUE)
-else (OPENLDAP_INCLUDE_DIR AND LIBLDAP AND LIBLBER)
- set(OPENLDAP_FOUND FALSE)
-endif (OPENLDAP_INCLUDE_DIR AND LIBLDAP AND LIBLBER)
+find_library(LDAP_LIBRARY ldap)
+find_library(LBER_LIBRARY lber)
-if (OPENLDAP_FOUND)
- message(STATUS "Found ldap: ${OPENLDAP_INCLUDE_DIR}")
-else (OPENLDAP_FOUND)
- if (NOT OPENLDAP_INCLUDE_DIR)
- message(FATAL_ERROR "Missing required ldap.h (openldap-devel)")
- else (NOT OPENLDAP_INCLUDE_DIR)
- message (FATAL_ERROR "Missing required LDAP libraries (openldap)")
- endif (NOT OPENLDAP_INCLUDE_DIR)
-endif (OPENLDAP_FOUND)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(OpenLdap DEFAULT_MSG
+ OPENLDAP_INCLUDE_DIR LDAP_LIBRARY LBER_LIBRARY)
-set(OPENLDAP_LIBS ${LIBLDAP} ${LIBLBER})
+set(OPENLDAP_LIBRARIES ${LDAP_LIBRARY} ${LBER_LIBRARY})
mark_as_advanced(
- OPENLDAP_INCLUDE_DIR OPENLDAP_LIB_DIR OPENLDAP_LIBRARIES
-)
+ OPENLDAP_INCLUDE_DIR LDAP_LIBRARY LBER_LIBRARY)