Browse Source

Merge pull request #10021 from Michael-Gardner/hpcc-17646

HPCC-17646 Memcached dependency added to esphttp and soaplib

Reviewed-By: Xiaoming Wang <xiaoming.wang@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 8 years ago
parent
commit
e10caebb70

+ 64 - 75
cmake_modules/FindLIBMEMCACHED.cmake

@@ -24,104 +24,93 @@
 #  MEMCACHED_USE_EXTERNAL_LIBRARY is ON, we will fetch, build, and include a copy of the neccessary
 #  Libraries.
 
+option(MEMCACHED_USE_EXTERNAL_LIBRARY "Pull and build source from external location if local is not found" ON)
+
+# Search for native library to build against
+if(WIN32)
+    set(libmemcached_lib "libmemcached")
+    set(libmemcachedUtil_lib "libmemcachedutil")
+else()
+    set(libmemcached_lib "memcached")
+    set(libmemcachedUtil_lib "memcachedutil")
+endif()
 
-if(NOT LIBMEMCACHED_FOUND)
-    option(MEMCACHED_USE_EXTERNAL_LIBRARY "Pull and build source from external location if local is not found" ON)
-    if(NOT LIBMEMCACHED_VERSION)
-        set(LIBMEMCACHED_VERSION "${LIBMEMCACHED_FIND_VERSION}")
-    endif()
-
-    # Search for native library to build against
-    if(WIN32)
-        set(libmemcached_lib "libmemcached")
-        set(libmemcachedUtil_lib "libmemcachedutil")
-    else()
-        set(libmemcached_lib "memcached")
-        set(libmemcachedUtil_lib "memcachedutil")
-    endif()
-
-    find_path(LIBMEMCACHED_INCLUDE_DIR libmemcached/memcached.hpp PATHS /usr/include /usr/share/include /usr/local/include PATH_SUFFIXES libmemcached)
-
-    find_library(LIBMEMCACHEDCORE_LIBRARY NAMES ${libmemcached_lib} PATHS /usr/lib usr/lib/libmemcached /usr/share /usr/lib64 /usr/local/lib /usr/local/lib64)
-    find_library(LIBMEMCACHEDUTIL_LIBRARY NAMES ${libmemcachedUtil_lib} PATHS /usr/lib /usr/share /usr/lib64 /usr/local/lib /usr/local/lib64)
+find_path(LIBMEMCACHED_INCLUDE_DIR libmemcached/memcached.hpp PATHS /usr/include /usr/share/include /usr/local/include PATH_SUFFIXES libmemcached)
+find_library(LIBMEMCACHEDCORE_LIBRARY NAMES ${libmemcached_lib} PATHS /usr/lib usr/lib/libmemcached /usr/share /usr/lib64 /usr/local/lib /usr/local/lib64)
+find_library(LIBMEMCACHEDUTIL_LIBRARY NAMES ${libmemcachedUtil_lib} PATHS /usr/lib /usr/share /usr/lib64 /usr/local/lib /usr/local/lib64)
 
-    set(LIBMEMCACHED_LIBRARIES ${LIBMEMCACHEDCORE_LIBRARY} ${LIBMEMCACHEDUTIL_LIBRARY})
+set(LIBMEMCACHED_LIBRARIES ${LIBMEMCACHEDCORE_LIBRARY} ${LIBMEMCACHEDUTIL_LIBRARY})
 
-    if(LIBMEMCACHED_INCLUDE_DIR)
-        file(STRINGS "${LIBMEMCACHED_INCLUDE_DIR}/libmemcached-1.0/configure.h" version REGEX "#define LIBMEMCACHED_VERSION_STRING")
-        string(REGEX REPLACE "#define LIBMEMCACHED_VERSION_STRING " "" version "${version}")
-        string(REGEX REPLACE "\"" "" version "${version}")
-        set(LIBMEMCACHED_VERSION_STRING ${version})
-        if("${LIBMEMCACHED_VERSION_STRING}" VERSION_EQUAL "${LIBMEMCACHED_FIND_VERSION}" OR "${LIBMEMCACHED_VERSION_STRING}" VERSION_GREATER "${LIBMEMCACHED_FIND_VERSION}")
-            set(LIBMEMCACHED_VERSION_OK 1)
-            set(MSG "${DEFAULT_MSG}")
-        else()
-            set(LIBMEMCACHED_VERSION_OK 0)
-            set(MSG "libmemcached version '${LIBMEMCACHED_VERSION_STRING}' incompatible with min version>=${LIBMEMCACHED_FIND_VERSION}")
-        endif()
+if(LIBMEMCACHED_INCLUDE_DIR)
+    file(STRINGS "${LIBMEMCACHED_INCLUDE_DIR}/libmemcached-1.0/configure.h" version REGEX "#define LIBMEMCACHED_VERSION_STRING")
+    string(REGEX REPLACE "#define LIBMEMCACHED_VERSION_STRING " "" version "${version}")
+    string(REGEX REPLACE "\"" "" version "${version}")
+    set(LIBMEMCACHED_VERSION_STRING ${version})
+    if("${LIBMEMCACHED_VERSION_STRING}" VERSION_EQUAL "${LIBMEMCACHED_FIND_VERSION}" OR "${LIBMEMCACHED_VERSION_STRING}" VERSION_GREATER "${LIBMEMCACHED_FIND_VERSION}")
+        set(LIBMEMCACHED_VERSION_OK 1)
+        set(MSG "${DEFAULT_MSG}")
+    else()
+        set(LIBMEMCACHED_VERSION_OK 0)
+        set(MSG "libmemcached version '${LIBMEMCACHED_VERSION_STRING}' incompatible with min version>=${LIBMEMCACHED_FIND_VERSION}")
     endif()
+endif()
 
-    include(FindPackageHandleStandardArgs)
-    find_package_handle_standard_args(libmemcached ${MSG}
-        LIBMEMCACHED_LIBRARIES
-        LIBMEMCACHED_INCLUDE_DIR
-        LIBMEMCACHED_VERSION_OK)
-
-    if(NOT LIBMEMCACHED_FOUND AND MEMCACHED_USE_EXTERNAL_LIBRARY)
-        # Currently libmemcached versions are not sufficient on ubuntu 12.04 and 14.04 LTS
-        # until then, we build the required libraries from source
-        set(LIBMEMCACHED_URL https://launchpad.net/libmemcached/1.0/${LIBMEMCACHED_VERSION}/+download/libmemcached-${LIBMEMCACHED_VERSION}.tar.gz)
+if(LIBMEMCACHEDCORE_LIBRARY STREQUAL "LIBMEMCACHEDCORE_LIBRARY-NOTFOUND"
+    OR LIBMEMCACHEDUTIL_LIBRARY STREQUAL "LIBMEMCACHEDUTIL_LIBRARY-NOTFOUND"
+    OR LIBMEMCACHED_INCLUDE_DIR STREQUAL "LIBMEMCACHED_INCLUDE_DIR-NOTFOUND"
+    OR NOT LIBMEMCACHED_VERSION_OK)
+    # Currently libmemcached versions are not sufficient on ubuntu 12.04 and 14.04 LTS
+    # until then, we build the required libraries from source
+    if(NOT TARGET generate-libmemcached)
+        set(LIBMEMCACHED_URL https://launchpad.net/libmemcached/1.0/${LIBMEMCACHED_FIND_VERSION}/+download/libmemcached-${LIBMEMCACHED_FIND_VERSION}.tar.gz)
         include(ExternalProject)
         ExternalProject_Add(
             generate-libmemcached
             URL ${LIBMEMCACHED_URL}
             DOWNLOAD_NO_PROGRESS 1
             TIMEOUT 15
-            PREFIX "ext"
-            CONFIGURE_COMMAND "${CMAKE_CURRENT_BINARY_DIR}/ext/src/generate-libmemcached/configure" --prefix=${INSTALL_DIR} LDFLAGS=-L${LIB_PATH}
+            DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/downloads
+            SOURCE_DIR ${CMAKE_BINARY_DIR}/downloads/libmemcached
+            CONFIGURE_COMMAND "${CMAKE_BINARY_DIR}/downloads/libmemcached/configure" --prefix=${INSTALL_DIR} LDFLAGS=-L${LIB_PATH}
             BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} LDFLAGS=-Wl,-rpath-link,${LIB_PATH}
-            BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}
+            BINARY_DIR ${CMAKE_BINARY_DIR}/build-libmemcached
             INSTALL_COMMAND "")
-        add_library(libmemcached SHARED IMPORTED)
-        add_library(libmemcachedutil SHARED IMPORTED)
+        add_library(libmemcached SHARED IMPORTED GLOBAL)
+        add_library(libmemcachedutil SHARED IMPORTED GLOBAL)
         set_property(TARGET libmemcached
-            PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/libmemcached/.libs/libmemcached.so.11.0.0)
+            PROPERTY IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/build-libmemcached/libmemcached/.libs/libmemcached.so.11.0.0)
         set_property(TARGET libmemcachedutil
-            PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/libmemcached/.libs/libmemcachedutil.so.2.0.0)
+            PROPERTY IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/build-libmemcached/libmemcached/.libs/libmemcachedutil.so.2.0.0)
         set_property(TARGET libmemcached
             PROPERTY IMPORTED_LINK_DEPENDENT_LIBRARIES libmemcachedutil)
         add_dependencies(libmemcached generate-libmemcached)
         add_dependencies(libmemcachedutil generate-libmemcached)
 
-        install(CODE "set(ENV{LD_LIBRARY_PATH} \"\$ENV{LD_LIBRARY_PATH}:${PROJECT_BINARY_DIR}:${PROJECT_BINARY_DIR}/libmemcached/.libs\")")
+        install(CODE "set(ENV{LD_LIBRARY_PATH} \"\$ENV{LD_LIBRARY_PATH}:${CMAKE_BINARY_DIR}:${CMAKE_BINARY_DIR}/build-libmemcached/libmemcached/.libs\")")
         install(PROGRAMS
-            ${CMAKE_CURRENT_BINARY_DIR}/libmemcached/.libs/libmemcached.so
-            ${CMAKE_CURRENT_BINARY_DIR}/libmemcached/.libs/libmemcached.so.11
-            ${CMAKE_CURRENT_BINARY_DIR}/libmemcached/.libs/libmemcached.so.11.0.0
-            ${CMAKE_CURRENT_BINARY_DIR}/libmemcached/.libs/libmemcachedutil.so
-            ${CMAKE_CURRENT_BINARY_DIR}/libmemcached/.libs/libmemcachedutil.so.2
-            ${CMAKE_CURRENT_BINARY_DIR}/libmemcached/.libs/libmemcachedutil.so.2.0.0
+            ${CMAKE_BINARY_DIR}/build-libmemcached/libmemcached/.libs/libmemcached.so
+            ${CMAKE_BINARY_DIR}/build-libmemcached/libmemcached/.libs/libmemcached.so.11
+            ${CMAKE_BINARY_DIR}/build-libmemcached/libmemcached/.libs/libmemcached.so.11.0.0
+            ${CMAKE_BINARY_DIR}/build-libmemcached/libmemcached/.libs/libmemcachedutil.so
+            ${CMAKE_BINARY_DIR}/build-libmemcached/libmemcached/.libs/libmemcachedutil.so.2
+            ${CMAKE_BINARY_DIR}/build-libmemcached/libmemcached/.libs/libmemcachedutil.so.2.0.0
             DESTINATION lib)
-
-        set(LIBMEMCACHED_LIBRARIES $<TARGET_FILE:libmemcached> $<TARGET_FILE:libmemcachedutil>)
-        set(LIBMEMCACHED_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/ext/src/generate-libmemcached)
-        if("${LIBMEMCACHED_VERSION}" VERSION_EQUAL "${LIBMEMCACHED_FIND_VERSION}" OR "${LIBMEMCACHED_VERSION}" VERSION_GREATER "${LIBMEMCACHED_FIND_VERSION}")
-            set(LIBMEMCACHED_VERSION_OK 1)
-            set(MSG "${DEFAULT_MSG}")
-        else()
-            set(LIBMEMCACHED_VERSION_OK 0)
-            set(MSG "libmemcached version '${LIBMEMCACHED_VERSION}' incompatible with min version>=${LIBMEMCACHED_FIND_VERSION}")
-        endif()
-
-        include(FindPackageHandleStandardArgs)
-        find_package_handle_standard_args(libmemcached ${MSG}
-            LIBMEMCACHED_LIBRARIES
-            LIBMEMCACHED_INCLUDE_DIR
-            LIBMEMCACHED_VERSION_OK)
-    else()
-        set(MEMCACHED_USE_EXTERNAL_LIBRARY OFF)
     endif()
 
-    mark_as_advanced(LIBMEMCACHED_INCLUDE_DIRS LIBMEMCACHED_LIBRARIES)
+    set(LIBMEMCACHEDCORE_LIBRARY $<TARGET_FILE:libmemcached>)
+    set(LIBMEMCACHEDUTIL_LIBRARY $<TARGET_FILE:libmemcachedutil>)
+    set(LIBMEMCACHED_LIBRARIES $<TARGET_FILE:libmemcached> $<TARGET_FILE:libmemcachedutil>)
+    set(LIBMEMCACHED_INCLUDE_DIR ${CMAKE_BINARY_DIR}/downloads/libmemcached)
+    # always assumed to be ok
+    set(LIBMEMCACHED_VERSION_OK 1)
+else()
+    set(MEMCACHED_USE_EXTERNAL_LIBRARY OFF)
 endif()
 
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(libmemcached DEFAULT_MSG
+    LIBMEMCACHEDCORE_LIBRARY
+    LIBMEMCACHEDUTIL_LIBRARY
+    LIBMEMCACHED_INCLUDE_DIR
+    LIBMEMCACHED_VERSION_OK)
+mark_as_advanced(LIBMEMCACHED_INCLUDE_DIR LIBMEMCACHED_LIBRARIES LIBMEMCACHEDCORE_LIBRARY LIBMEMCACHEDUTIL_LIBRARY)

+ 2 - 0
cmake_modules/commonSetup.cmake

@@ -167,6 +167,8 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
     endforeach()
     #"cmake -DEXAMPLEPLUGIN=ON <path-to/HPCC-Platform/>" will configure the plugin makefiles to be built with "make".
 
+  set(LIBMEMCACHED_MINVERSION "1.0.10")
+
   if (SIGN_MODULES)
       message(STATUS "GPG signing check")
       execute_process(COMMAND bash "-c" "gpg --version | awk 'NR==1{print $3}'"

+ 60 - 50
esp/bindings/SOAP/soaplib/CMakeLists.txt

@@ -14,68 +14,78 @@
 #    limitations under the License.
 ################################################################################
 
+# Component: soaplib
 
-# Component: soaplib 
 #####################################################
 # Description:
 # ------------
 #    Cmake Input File for soaplib
 #####################################################
 
+project(soaplib)
 
-project( soaplib ) 
+find_package(LIBMEMCACHED ${LIBMEMCACHED_MINVERSION})
+if(LIBMEMCACHED_FOUND)
+    add_definitions(-DUSE_LIBMEMCACHED)
+    include_directories(${LIBMEMCACHED_INCLUDE_DIR})
+endif()
 
-set (    SRCS 
-         ../../../platform/espcontext.cpp 
-         ../../../platform/espprotocol.cpp 
-         ../../../platform/espthread.cpp 
-         ../../../platform/sechandler.cpp 
-         ../../../platform/txsummary.cpp
-         ../../../protocols/http/mapinfo.cpp 
-         ../../bindutil.cpp 
-         ../../http/client/httpclient.cpp 
-         ../../http/platform/htmlpage.cpp 
-         ../../http/platform/httpbinding.cpp 
-         ../../http/platform/httpprot.cpp 
-         ../../http/platform/httpsecurecontext.cpp
-         ../../http/platform/httpservice.cpp 
-         ../../http/platform/httptransport.cpp 
-         ../../http/platform/mime.cpp 
-         ../../http/platform/msgbuilder.cpp 
-         ../client/soapclient.cpp 
-         ../Platform/soapbind.cpp 
-         ../Platform/soapmessage.cpp 
-         ../Platform/soapservice.cpp 
+set(SRCS
+    ../../../platform/espcontext.cpp
+    ../../../platform/espprotocol.cpp
+    ../../../platform/espthread.cpp
+    ../../../platform/sechandler.cpp
+    ../../../platform/txsummary.cpp
+    ../../../protocols/http/mapinfo.cpp
+    ../../bindutil.cpp
+    ../../http/client/httpclient.cpp
+    ../../http/platform/htmlpage.cpp
+    ../../http/platform/httpbinding.cpp
+    ../../http/platform/httpprot.cpp
+    ../../http/platform/httpsecurecontext.cpp
+    ../../http/platform/httpservice.cpp
+    ../../http/platform/httptransport.cpp
+    ../../http/platform/mime.cpp
+    ../../http/platform/msgbuilder.cpp
+    ../client/soapclient.cpp
+    ../Platform/soapbind.cpp
+    ../Platform/soapmessage.cpp
+    ../Platform/soapservice.cpp
     )
 
-include_directories ( 
-         ./../../../../system/include 
-         ./../../../../system/security/shared
-         ./../../../../system/security/securesocket 
-         ./../../../../system/security/LdapSecurity
-         ./../../../../system/jlib 
-         ./../../../bindings 
-         ./../../../platform 
-         ./../../../services/common
-         ./../../../../system/xmllib 
-         ./.. 
-         ./../../../bindings/SOAP/xpp 
+include_directories(
+    ./../../../../system/include
+    ./../../../../system/security/shared
+    ./../../../../system/security/securesocket
+    ./../../../../system/security/LdapSecurity
+    ./../../../../system/jlib
+    ./../../../bindings
+    ./../../../platform
+    ./../../../services/common
+    ./../../../../system/xmllib
+    ./..
+    ./../../../bindings/SOAP/xpp
     )
 
-ADD_DEFINITIONS( -DESPHTTP_EXPORTS )
+add_definitions(-DESPHTTP_EXPORTS)
 
-if (WIN32)
-    ADD_DEFINITIONS( -D_LIB )
-    HPCC_ADD_LIBRARY( soaplib STATIC ${SRCS} )
-else (WIN32)
-    HPCC_ADD_LIBRARY( soaplib SHARED ${SRCS} )
-    install ( TARGETS soaplib RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${LIB_DIR} )
-    target_link_libraries (soaplib 
-        jlib
-        )
-endif (WIN32)
-add_dependencies (soaplib 
-    jlib
-    espscm
-    )
+if(WIN32)
+    add_definitions(-D_LIB)
+    HPCC_ADD_LIBRARY(soaplib STATIC ${SRCS})
+else(WIN32)
+    HPCC_ADD_LIBRARY(soaplib SHARED ${SRCS})
+    install(TARGETS soaplib RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${LIB_DIR})
+    target_link_libraries(soaplib jlib)
+endif(WIN32)
+
+add_dependencies(soaplib jlib espscm)
 
+if(LIBMEMCACHED_FOUND)
+    if(MEMCACHED_USE_EXTERNAL_LIBRARY)
+        target_link_libraries(soaplib libmemcached libmemcachedutil)
+        add_dependencies(soaplib generate-libmemcached)
+        install(CODE "set(ENV{LD_LIBRARY_PATH} \"\$ENV{LD_LIBRARY_PATH}:${PROJECT_BINARY_DIR}:${CMAKE_BINARY_DIR}/build-libmemcached/libmemcached/.libs\")")
+    else()
+        target_link_libraries(soaplib ${LIBMEMCACHED_LIBRARIES})
+    endif()
+endif()

+ 64 - 49
esp/protocols/http/CMakeLists.txt

@@ -14,8 +14,7 @@
 #    limitations under the License.
 ################################################################################
 
-
-# Component: esphttp 
+# Component: esphttp
 
 #####################################################
 # Description:
@@ -23,60 +22,76 @@
 #    Cmake Input File for esphttp
 #####################################################
 
+project(esphttp)
 
-project( esphttp ) 
+find_package(LIBMEMCACHED ${LIBMEMCACHED_MINVERSION})
+if(LIBMEMCACHED_FOUND)
+    add_definitions(-DUSE_LIBMEMCACHED)
+    include_directories(${LIBMEMCACHED_INCLUDE_DIR})
+endif()
 
-set (    SRCS 
-         ../../bindings/bindutil.cpp 
-         ../../bindings/http/client/httpclient.cpp 
-         ../../bindings/http/platform/htmlpage.cpp 
-         ../../bindings/http/platform/httpbinding.cpp 
-         ../../bindings/http/platform/httpprot.cpp 
-         ../../bindings/http/platform/httpsecurecontext.cpp
-         ../../bindings/http/platform/httpservice.cpp 
-         ../../bindings/http/platform/httptransport.cpp 
-         ../../bindings/http/platform/mime.cpp 
-         ../../bindings/http/platform/msgbuilder.cpp 
-         ../../bindings/SOAP/client/soapclient.cpp 
-         ../../bindings/SOAP/Platform/soapbind.cpp 
-         ../../bindings/SOAP/Platform/soapmessage.cpp 
-         ../../bindings/SOAP/Platform/soapservice.cpp 
-         ../../bindings/SOAP/Platform/soapparam.cpp
-         ../../platform/espcontext.cpp 
-         ../../platform/espprotocol.cpp 
-         ../../platform/espthread.cpp 
-         ../../platform/sechandler.cpp 
-         ../../platform/txsummary.cpp
-         mapinfo.cpp 
-         plugin.cpp 
+set(SRCS
+    ../../bindings/bindutil.cpp
+    ../../bindings/http/client/httpclient.cpp
+    ../../bindings/http/platform/htmlpage.cpp
+    ../../bindings/http/platform/httpbinding.cpp
+    ../../bindings/http/platform/httpprot.cpp
+    ../../bindings/http/platform/httpsecurecontext.cpp
+    ../../bindings/http/platform/httpservice.cpp
+    ../../bindings/http/platform/httptransport.cpp
+    ../../bindings/http/platform/mime.cpp
+    ../../bindings/http/platform/msgbuilder.cpp
+    ../../bindings/SOAP/client/soapclient.cpp
+    ../../bindings/SOAP/Platform/soapbind.cpp
+    ../../bindings/SOAP/Platform/soapmessage.cpp
+    ../../bindings/SOAP/Platform/soapservice.cpp
+    ../../bindings/SOAP/Platform/soapparam.cpp
+    ../../platform/espcontext.cpp
+    ../../platform/espprotocol.cpp
+    ../../platform/espthread.cpp
+    ../../platform/sechandler.cpp
+    ../../platform/txsummary.cpp
+    mapinfo.cpp
+    plugin.cpp
     )
 
-include_directories ( 
-         ./../../../system/include 
-         ./../../../system/security/shared
-         ./../../../system/security/securesocket 
-         ./../../bindings 
-         ./../../bindings/SOAP/xpp 
-         ./../../../system/xmllib 
-         ./../../../system/jlib 
-         ./../../platform 
-         ./../../services/common
-         ./../../../system/security/shared 
-         ./../../../system/security/LdapSecurity
+include_directories(
+    ./../../../system/include
+    ./../../../system/security/shared
+    ./../../../system/security/securesocket
+    ./../../bindings
+    ./../../bindings/SOAP/xpp
+    ./../../../system/xmllib
+    ./../../../system/jlib
+    ./../../platform
+    ./../../services/common
+    ./../../../system/security/shared
+    ./../../../system/security/LdapSecurity
     )
 
-ADD_DEFINITIONS( -DESPHTTP_EXPORTS -DESP_TIMING -D_USRDLL -DESP_PLUGIN )
+add_definitions(-DESPHTTP_EXPORTS -DESP_TIMING -D_USRDLL -DESP_PLUGIN)
 
-HPCC_ADD_LIBRARY( esphttp SHARED ${SRCS} )
-add_dependencies (esphttp  espscm )
-install ( TARGETS esphttp RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${LIB_DIR} )
-target_link_libraries ( esphttp 
-         ${XALAN_LIBRARIES} ${XERCES_LIBRARIES}
-         jlib
-         xmllib 
+HPCC_ADD_LIBRARY(esphttp SHARED ${SRCS})
+add_dependencies(esphttp  espscm)
+install(TARGETS esphttp RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${LIB_DIR})
+target_link_libraries(
+    esphttp
+    ${XALAN_LIBRARIES}
+    ${XERCES_LIBRARIES}
+    jlib
+    xmllib
     )
-IF (USE_OPENLDAP)
-target_link_libraries ( esphttp LdapSecurity )
-ENDIF(USE_OPENLDAP)
 
+if(LIBMEMCACHED_FOUND)
+    if(MEMCACHED_USE_EXTERNAL_LIBRARY)
+        target_link_libraries(esphttp libmemcached libmemcachedutil)
+        add_dependencies(esphttp generate-libmemcached)
+        install(CODE "set(ENV{LD_LIBRARY_PATH} \"\$ENV{LD_LIBRARY_PATH}:${PROJECT_BINARY_DIR}:${CMAKE_BINARY_DIR}/build-libmemcached/libmemcached/.libs\")")
+    else()
+        target_link_libraries(esphttp ${LIBMEMCACHED_LIBRARIES})
+    endif()
+endif()
 
+if(USE_OPENLDAP)
+    target_link_libraries(esphttp LdapSecurity)
+endif(USE_OPENLDAP)

+ 6 - 8
plugins/memcached/CMakeLists.txt

@@ -25,9 +25,6 @@
 project( memcachedplugin )
 
 if (MEMCACHED)
-    if(NOT DEFINED LIBMEMCACHED_MINVERSION)
-        set(LIBMEMCACHED_MINVERSION "1.0.10")
-    endif()
     ADD_PLUGIN(memcached PACKAGES LIBMEMCACHED MINVERSION ${LIBMEMCACHED_MINVERSION})
     if(MAKE_MEMCACHED)
 
@@ -57,11 +54,6 @@ if (MEMCACHED)
             set_target_properties(memcachedplugin PROPERTIES NO_SONAME 1)
         endif()
 
-        #if we are using generated libmemcached, target appropriate dependencies
-        if(MEMCACHED_USE_EXTERNAL_LIBRARY)
-            add_dependencies(memcachedplugin libmemcached libmemcachedutil)
-            install(CODE "set(ENV{LD_LIBRARY_PATH} \"\$ENV{LD_LIBRARY_PATH}:${PROJECT_BINARY_DIR}:${PROJECT_BINARY_DIR}/libmemcached-${LIBMEMCACHED_VERSION}/libmemcached/.libs\")")
-        endif()
         target_link_libraries(
             memcachedplugin
             eclrtl
@@ -71,6 +63,12 @@ if (MEMCACHED)
         install(
             TARGETS memcachedplugin
             DESTINATION plugins)
+
+        if(MEMCACHED_USE_EXTERNAL_LIBRARY)
+            target_link_libraries(memcachedplugin libmemcached libmemcachedutil)
+            add_dependencies(memcachedplugin generate-libmemcached)
+            install(CODE "set(ENV{LD_LIBRARY_PATH} \"\$ENV{LD_LIBRARY_PATH}:${PROJECT_BINARY_DIR}:${CMAKE_BINARY_DIR}/build-libmemcached/libmemcached/.libs\")")
+        endif()
     endif()
 endif()