Skip to content

Commit

Permalink
Add zlib to libs when finding openssl (RIPD-1496):
Browse files Browse the repository at this point in the history
if openssl is configured with compression support AND you link
to the static lib, you are going to need to link to zlib.

Fundamentally the CMake finder should take care of this (as
described in https://gitlab.kitware.com/cmake/cmake/issues/16885),
but we work around it here by adding zlib explicitly. Update
beast error test for OpenSSL 1.1.0
  • Loading branch information
mellery451 authored and nbougalis committed Aug 10, 2017
1 parent 60dd194 commit 36423a5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Builds/CMake/CMakeFuncs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,19 @@ macro(use_openssl openssl_min)
endif()

find_package(OpenSSL)
# depending on how openssl is built, it might depend
# on zlib. In fact, the openssl find package should
# figure this out for us, but it does not currently...
# so let's add zlib ourselves to the lib list
find_package(ZLIB)

if (static)
set(CMAKE_FIND_LIBRARY_SUFFIXES tmp)
endif()

if (OPENSSL_FOUND)
include_directories(${OPENSSL_INCLUDE_DIR})
list(APPEND OPENSSL_LIBRARIES ${ZLIB_LIBRARIES})
else()
message(FATAL_ERROR "OpenSSL not found")
endif()
Expand Down
5 changes: 5 additions & 0 deletions src/test/beast/beast_asio_error_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ class error_test : public unit_test::suite
boost::system::error_code (335544539,
boost::asio::error::get_ssl_category ());
std::string const s = beast::error_message_with_ssl(ec);

#ifdef SSL_R_SHORT_READ
BEAST_EXPECT(s == " (20,0,219) error:140000DB:SSL routines:SSL routines:short read");
#else
BEAST_EXPECT(s == " (20,0,219) error:140000DB:SSL routines:SSL routines:reason(219)");
#endif
}
}
};
Expand Down

0 comments on commit 36423a5

Please sign in to comment.