From 5bf340ebae9790de4d5aa4d190b267774e28b6c6 Mon Sep 17 00:00:00 2001 From: Marcus Watts Date: Fri, 25 Mar 2016 06:11:34 -0400 Subject: [PATCH] Update SSL support a bit. Use cmake's FindOpenSSL. Actually use the library definitions that come out of it. Also use the include path. If SSL is disabled, then build without any of this. The result will be a version of civetweb that includes openssl support using dlopen() - ie, what we used to do. This is probably a bit silly, and I hope nobody actually expects to use it that way, but it's mostly harmless. Signed-off-by: Marcus Watts --- CMakeLists.txt | 7 +++++-- cmake/modules/FindOpenSSL.cmake | 37 --------------------------------- src/CMakeLists.txt | 9 ++++++-- 3 files changed, 12 insertions(+), 41 deletions(-) delete mode 100644 cmake/modules/FindOpenSSL.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ae5530c143..bb9e28b6711 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -145,8 +145,11 @@ endif(${WITH_OPENLDAP}) option(WITH_OPENSSL "OPENSSL is here" ON) if(${WITH_OPENSSL}) find_package(OpenSSL REQUIRED) -set(HAVE_OPENSSL ${OPENSSL_FOUND}) -message(STATUS "${OPENSSL_LIBS}") +set(HAVE_OPENSSL ON) +#message(STATUS "${OPENSSL_LIBRARIES}") +else(${WITH_OPENSSL}) +set(HAVE_OPENSSL OFF) +set(OPENSSL_LIBRARIES) endif(${WITH_OPENSSL}) option(WITH_FUSE "Fuse is here" ON) diff --git a/cmake/modules/FindOpenSSL.cmake b/cmake/modules/FindOpenSSL.cmake deleted file mode 100644 index 517e1f6244c..00000000000 --- a/cmake/modules/FindOpenSSL.cmake +++ /dev/null @@ -1,37 +0,0 @@ -# - Find OpenSSL Header and Libraries -# -# OPENSSL_PREFIX - where to find ssl.h and libraries -# OPENSSL_FOUND - True if found. - -set(OPENSSL_LIB_DIR "${OPENSSL_PREFIX}/lib") - -find_path(OPENSSL_INCLUDE_DIR ssl/ssl.h NO_DEFAULT_PATH PATHS - /usr/include - /opt/local/include - /usr/local/include - "${OPENSSL_PREFIX}/include" - ) - -find_library(LIBSSL NAMES ssl) - -if (OPENSSL_INCLUDE_DIR AND LIBSSL) - set(OPENSSL_FOUND TRUE) -else (OPENSSL_INCLUDE_DIR AND LIBSSL) - set(OPENSSL_FOUND FALSE) -endif (OPENSSL_INCLUDE_DIR AND LIBSSL) - -if (OPENSSL_FOUND) - message(STATUS "Found ldap: ${OPENSSL_INCLUDE_DIR}") -else (OPENSSL_FOUND) - if (NOT OPENSSL_INCLUDE_DIR) - message(FATAL_ERROR "Missing required ssl/ssl.h (openssl-devel)") - else (NOT OPENSSL_INCLUDE_DIR) - message (FATAL_ERROR "Missing required OpenSSL libraries") - endif (NOT OPENSSL_INCLUDE_DIR) -endif (OPENSSL_FOUND) - -set(OPENSSL_LIBS ${LIBSSL}) - -mark_as_advanced( - OPENSSL_INCLUDE_DIR OPENSSL_LIB_DIR OPENSSL_LIBRARIES -) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 46f5bd14589..a032662776a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1203,8 +1203,13 @@ if(${WITH_RADOSGW}) add_library(civetweb_common_objs OBJECT ${civetweb_common_files}) target_include_directories(civetweb_common_objs PUBLIC "${CMAKE_SOURCE_DIR}/src/civetweb/include") + if(HAVE_OPENSSL) set_property(TARGET civetweb_common_objs APPEND PROPERTY COMPILE_DEFINITIONS NO_SSL_DL=1) + target_include_directories(civetweb_common_objs PUBLIC + "${OPENSSL_INCLUDE_DIR}") + else(HAVE_OPENSSL) + endif(HAVE_OPENSSL) add_library(rgw_a STATIC ${rgw_a_srcs}) target_link_libraries(rgw_a librados cls_rgw_client cls_refcount_client @@ -1267,7 +1272,7 @@ if(${WITH_RADOSGW}) cls_rgw_client cls_lock_client cls_refcount_client cls_log_client cls_statelog_client cls_timeindex_client cls_version_client cls_replica_log_client cls_user_client - curl expat global fcgi resolv ssl crypto ${BLKID_LIBRARIES} ${OPENLDAP_LIBS} + curl expat global fcgi resolv ${OPENSSL_LIBRARIES} ${BLKID_LIBRARIES} ${OPENLDAP_LIBS} ${ALLOC_LIBS}) install(TARGETS radosgw DESTINATION bin) @@ -1276,7 +1281,7 @@ if(${WITH_RADOSGW}) cls_rgw_client cls_lock_client cls_refcount_client cls_log_client cls_statelog_client cls_timeindex_client cls_version_client cls_replica_log_client cls_user_client - curl expat global fcgi resolv ssl crypto ${BLKID_LIBRARIES}) + curl expat global fcgi resolv ${OPENSSL_LIBRARIES} ${BLKID_LIBRARIES}) install(TARGETS radosgw-admin DESTINATION bin)