From 86e1cb83db45fbeccea6078f7e12e958433e7be6 Mon Sep 17 00:00:00 2001 From: theoreticalbts Date: Wed, 28 Sep 2016 14:34:57 -0400 Subject: [PATCH] Link with zlib and bzip2 libraries, if found These libraries are not required by FC. However, the only way I've found to get CMake to pass them to the linker in an order which will allow steemd to successfully link, is to put them in FC's CMakeLists.txt. --- CMakeLists.txt | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3db7c86..c8da424 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -304,6 +304,31 @@ ELSE() ENDIF() ENDIF() +IF(APPLE) + # As of 10.10 yosemite, the OpenSSL static libraries shipped with os x have a dependency + # on zlib, so any time you link in openssl you also need to link zlib. . We really want to detect whether openssl was configured with the --no-zlib + # option or not when it was built, but that's difficult to do in practice, so we + # just always try to link it in on mac. + find_package( ZLIB REQUIRED ) +ELSE(APPLE) + find_package( ZLIB ) +ENDIF(APPLE) + +if( ZLIB_FOUND ) + MESSAGE( STATUS "zlib found" ) + add_definitions( -DHAS_ZLIB ) +else() + MESSAGE( STATUS "zlib not found" ) +endif( ZLIB_FOUND ) + +find_package( BZip2 ) +if( BZIP2_FOUND ) + MESSAGE( STATUS "bzip2 found" ) + add_definitions( -DHAS_BZIP2 ) +else() + MESSAGE( STATUS "bzip2 not found" ) +endif( BZIP2_FOUND ) + # This will become unnecessary once we update to websocketpp which fixes upstream issue #395 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWEBSOCKETPP_STRICT_MASKING") @@ -324,11 +349,11 @@ target_include_directories(fc ${CMAKE_CURRENT_SOURCE_DIR}/vendor/secp256k1-zkp ) -#target_link_libraries( fc PUBLIC udt ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS} ${RPCRT4} ${CMAKE_DL_LIBS} ${rt_library} ${ECC_LIB} ) +#target_link_libraries( fc PUBLIC udt ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS} ${RPCRT4} ${CMAKE_DL_LIBS} ${rt_library} ${ECC_LIB} ) IF(NOT WIN32) set(LINK_USR_LOCAL_LIB -L/usr/local/lib) ENDIF() -target_link_libraries( fc PUBLIC ${LINK_USR_LOCAL_LIB} udt ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS} ${RPCRT4} ${CMAKE_DL_LIBS} ${rt_library} ${readline_libraries} ${ECC_LIB} ) +target_link_libraries( fc PUBLIC ${LINK_USR_LOCAL_LIB} udt ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS} ${RPCRT4} ${CMAKE_DL_LIBS} ${rt_library} ${readline_libraries} ${ECC_LIB} ) if(MSVC) set_source_files_properties( src/network/http/websocket.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) @@ -493,14 +518,6 @@ if(WIN32) endif(WIN32) -IF(APPLE) - # As of 10.10 yosemite, the OpenSSL static libraries shipped with os x have a dependency - # on zlib, so any time you link in openssl you also need to link zlib. . We really want to detect whether openssl was configured with the --no-zlib - # option or not when it was built, but that's difficult to do in practice, so we - # just always try to link it in on mac. - find_package( ZLIB REQUIRED ) -ENDIF(APPLE) - SET(OPENSSL_CONF_TARGET ) IF(DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY) SET (OPENSSL_CONF_TARGET ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})