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 <mwatts@redhat.com>
This commit is contained in:
Marcus Watts 2016-03-25 06:11:34 -04:00
parent 8e87ce74e7
commit 5bf340ebae
3 changed files with 12 additions and 41 deletions

View File

@ -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)

View File

@ -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
)

View File

@ -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)