diff --git a/cmake/modules/FindDCAP.cmake b/cmake/modules/FindDCAP.cmake
index 0b342a204f37e60706f0ec6c32a66d4fd7380ee5..6cb26c6e3f0301f3208be018ce3570dcbff06889 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 0000000000000000000000000000000000000000..33f610696b8c95c697e6a4fbda7e1faf9d251073
--- /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 638e6c299f1338042bc031394aaff0b36b1b3fde..d8fdfdcf15656fc3210c7df5539c2c68a646a605 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 b174fcfdcae25fe739da84d347163aafe1902016..86288688cf2bda4ee429cfdb98dace441066ecbd 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 c60734a3edd80cb19d44c0f41585bfd16ff180bb..6d8bd7e03f10e7392f7bcb8366893a2db3a8d2ae 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 0000000000000000000000000000000000000000..bc33032e0b80a4e4db6df16fe8dedf8920db005e
--- /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()