X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=cmake%2FFindLdap.cmake;h=2c96faeb76901962055ed31b445988c4d9884aaf;hp=2f0c0dd27428dea21ecb8fa79bd2bc6066c93de9;hb=222d0be6ffa0f6c63c3c8c5a303260b9aee10e68;hpb=07473582d22eddd934ee52127cad2baa11943d59 diff --git a/cmake/FindLdap.cmake b/cmake/FindLdap.cmake index 2f0c0dd2..2c96faeb 100644 --- a/cmake/FindLdap.cmake +++ b/cmake/FindLdap.cmake @@ -13,16 +13,32 @@ if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES) set(Ldap_FIND_QUIETLY TRUE) endif(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES) -#if(UNIX) # Attempt to link against ldap.h regardless of platform! FIND_PATH(LDAP_INCLUDE_DIR ldap.h) + +# If we detect path to invalid ldap.h on osx, try /usr/include/ +# This might also be achievable with additional parameters to FIND_PATH. +string(TOLOWER ${LDAP_INCLUDE_DIR} ldapincludelower) +if("${ldapincludelower}" MATCHES "\\/system\\/library\\/frameworks\\/ldap\\.framework\\/headers") + set(LDAP_INCLUDE_DIR "/usr/include/") +endif() + FIND_LIBRARY(LDAP_LIBRARIES NAMES ldap) + +# On osx remove invalid ldap.h +string(TOLOWER ${LDAP_LIBRARIES} ldaplower) +if("${ldaplower}" MATCHES "\\/system\\/library\\/frameworks\\/ldap\\.framework") + set(LDAP_LIBRARIES FALSE) +endif() + FIND_LIBRARY(LBER_LIBRARIES NAMES lber) -#else(UNIX) +# It'd be nice to link against winldap on Windows, unfortunately +# the interfaces are different. In theory a compatibility shim +# could be written; if someone ever gets around to doing that these +# lines should be uncommented and used on Windows. # FIND_PATH(LDAP_INCLUDE_DIR winldap.h) # FIND_LIBRARY(LDAP_LIBRARIES NAMES wldap32) -#endif(UNIX) if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES) set(LDAP_FOUND TRUE)