1
0
mirror of https://github.com/altlinux/admc.git synced 2025-01-30 17:47:04 +03:00
admc/cmake/FindLdap.cmake
Dmitry Degtyarev 925f529fe7 use target_include_directories
\instead of set_target_properties INTERFACE_INCLUDE_DIRECTORIES
2020-09-10 13:50:45 +04:00

64 lines
1.2 KiB
CMake

# Finds LDAP C Libraries
#
# Defined vars:
# Ldap_FOUND
# Ldap_INCLUDE_DIRS
#
# Imported targets:
# Ldap::Ldap
find_path(LDAP_INCLUDE_DIR
NAMES ldap.h
PATHS
/usr/include
/usr/local/include
/opt/local/include
)
find_library(LDAP_LIBRARY ldap)
find_path(LBER_INCLUDE_DIR
NAMES lber.h
PATHS
/usr/include
/usr/local/include
/opt/local/include
)
find_library(LBER_LIBRARY lber)
mark_as_advanced(
LDAP_INCLUDE_DIR
LBER_INCLUDE_DIR
LDAP_LIBRARY
LBER_LIBRARY
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Ldap
FOUND_VAR Ldap_FOUND
REQUIRED_VARS
LDAP_INCLUDE_DIR
LBER_INCLUDE_DIR
LDAP_LIBRARY
LBER_LIBRARY
)
if(Ldap_FOUND)
set(Ldap_INCLUDE_DIRS ${LDAP_INCLUDE_DIR} ${LBER_INCLUDE_DIR})
list(REMOVE_DUPLICATES Ldap_INCLUDE_DIRS)
endif()
if(Ldap_FOUND AND NOT TARGET Ldap::Ldap)
add_library(Ldap::Ldap INTERFACE IMPORTED)
target_link_libraries(Ldap::Ldap
INTERFACE
ldap
lber
)
target_include_directories(Ldap::Ldap
INTERFACE
${Ldap_INCLUDE_DIRS}
)
endif()