From c0c6772975de1975115aae8aa293d71ada9c3646 Mon Sep 17 00:00:00 2001 From: Pere Mato Vila <mato@cern.ch> Date: Tue, 21 May 2013 18:20:15 +0200 Subject: [PATCH] Added LDAP on the CMake builds --- cmake/modules/FindDCAP.cmake | 1 - cmake/modules/FindLdap.cmake | 24 +++++++++++++++++++++ cmake/modules/SearchInstalledSoftware.cmake | 14 ++++++++++++ io/dcache/CMakeLists.txt | 1 + net/CMakeLists.txt | 4 +++- net/ldap/CMakeLists.txt | 12 +++++++++++ 6 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 cmake/modules/FindLdap.cmake create mode 100644 net/ldap/CMakeLists.txt diff --git a/cmake/modules/FindDCAP.cmake b/cmake/modules/FindDCAP.cmake index 0b342a204f3..6cb26c6e3f0 100644 --- a/cmake/modules/FindDCAP.cmake +++ b/cmake/modules/FindDCAP.cmake @@ -12,7 +12,6 @@ find_library(DCAP_LIBRARY NAMES dcap HINTS ${DCAP_DIR}/lib $ENV{DCAP_DIR}/lib) set(DCAP_INCLUDE_DIRS ${DCAP_INCLUDE_DIR}) set(DCAP_LIBRARIES ${DCAP_LIBRARY}) -add_definitions(-pthread) # handle the QUIETLY and REQUIRED arguments and set DCAP_FOUND to TRUE if # all listed variables are TRUE diff --git a/cmake/modules/FindLdap.cmake b/cmake/modules/FindLdap.cmake new file mode 100644 index 00000000000..33f610696b8 --- /dev/null +++ b/cmake/modules/FindLdap.cmake @@ -0,0 +1,24 @@ +# - Try to find the LDAP client libraries +# Once done this will define +# +# LDAP_FOUND - system has libldap +# LDAP_INCLUDE_DIR - the ldap include directory +# LDAP_LIBRARY libldap library +# LBER_LIBRARY liblber library +# LDAP_LIBRARIES - libldap + liblber (if found) library + + +find_path(LDAP_INCLUDE_DIR NAMES ldap.h HINTS ${LDAP_DIR}/include $ENV{LDAP_DIR}/include) +find_library(LDAP_LIBRARY NAMES ldap HINTS ${LDAP_DIR}/lib $ENV{LDAP_DIR}/lib) +find_library(LBER_LIBRARY NAMES lber HINTS ${LDAP_DIR}/lib $ENV{LDAP_DIR}/lib) + +set(LDAP_INCLUDE_DIRS ${LDAP_INCLUDE_DIR}) +set(LDAP_LIBRARIES ${LDAP_LIBRARY} ${LBER_LIBRARY}) + +# handle the QUIETLY and REQUIRED arguments and set LDAP_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LDAP DEFAULT_MSG LDAP_INCLUDE_DIR LDAP_LIBRARY) + +mark_as_advanced(LDAP_FOUND LDAP_INCLUDE_DIR LDAP_LIBRARY LBER_LIBRARY) + diff --git a/cmake/modules/SearchInstalledSoftware.cmake b/cmake/modules/SearchInstalledSoftware.cmake index 638e6c299f1..d8fdfdcf156 100644 --- a/cmake/modules/SearchInstalledSoftware.cmake +++ b/cmake/modules/SearchInstalledSoftware.cmake @@ -661,6 +661,20 @@ if(dcache) endif() endif() +#---Check for Ldap-------------------------------------------------------------------- +if(ldap) + find_package(Ldap) + if(NOT LDAP_FOUND) + if(fail-on-missing) + message(FATAL_ERROR "ldap library not found and is required (ldap option enabled)") + else() + message(STATUS "ldap library not found. Set variable LDAP_DIR to point to your ldap installation") + message(STATUS "For the time being switching OFF 'ldap' option") + set(ldap OFF CACHE BOOL "" FORCE) + endif() + endif() +endif() + #---Report non implemented options--------------------------------------------------- foreach(opt afs chirp clarens cling glite globus hdfs lzma pch peac sapdb srp) diff --git a/io/dcache/CMakeLists.txt b/io/dcache/CMakeLists.txt index b174fcfdcae..86288688cf2 100644 --- a/io/dcache/CMakeLists.txt +++ b/io/dcache/CMakeLists.txt @@ -5,6 +5,7 @@ ROOT_USE_PACKAGE(io/io) ROOT_USE_PACKAGE(net/net) include_directories(${DCAP_INCLUDE_DIRS}) +add_definitions(-pthread) ROOT_GENERATE_DICTIONARY(G__DCache *.h LINKDEF LinkDef.h) ROOT_GENERATE_ROOTMAP(DCache LINKDEF LinkDef.h DEPENDENCIES Net RIO) diff --git a/net/CMakeLists.txt b/net/CMakeLists.txt index c60734a3edd..6d8bd7e03f1 100644 --- a/net/CMakeLists.txt +++ b/net/CMakeLists.txt @@ -23,5 +23,7 @@ if(monalisa) add_subdirectory(monalisa) endif() - +if(ldap) + add_subdirectory(ldap) +endif() diff --git a/net/ldap/CMakeLists.txt b/net/ldap/CMakeLists.txt new file mode 100644 index 00000000000..bc33032e0b8 --- /dev/null +++ b/net/ldap/CMakeLists.txt @@ -0,0 +1,12 @@ +############################################################################ +# CMakeLists.txt file for building ROOT net/ldap package +############################################################################ + +ROOT_USE_PACKAGE(net/net) +include_directories(${LDAP_INCLUDE_DIRS}) +add_definitions(-DLDAP_DEPRECATED) + +ROOT_GENERATE_DICTIONARY(G__LDAP *.h LINKDEF LinkDef.h) +ROOT_GENERATE_ROOTMAP(RLDAP LINKDEF LinkDef.h DEPENDENCIES Net RIO) +ROOT_LINKER_LIBRARY(RLDAP *.cxx G__LDAP.cxx LIBRARIES Core ${LDAP_LIBRARIES} DEPENDENCIES Net) +ROOT_INSTALL_HEADERS() -- GitLab