Fix CMake/zlibstatic-related regression (#192)
* cmake: add export() and install(EXPORT) for easier packageability Enable the package to be more readily packageable as a system-wide install or as a third-party dependency to another CMake-base project This does not change CMake version requirements AFAICT * CMake: link-in OpenSSL::Crypto * CMake: explicitly manage dependencies. Fixes building with zlibstatic
This commit is contained in:
parent
1096f62196
commit
9e54fd5f1a
@ -175,16 +175,16 @@ if (USE_TLS)
|
|||||||
endif()
|
endif()
|
||||||
message(STATUS "OpenSSL: " ${OPENSSL_VERSION})
|
message(STATUS "OpenSSL: " ${OPENSSL_VERSION})
|
||||||
|
|
||||||
target_link_libraries(ixwebsocket OpenSSL::SSL OpenSSL::Crypto)
|
target_link_libraries(ixwebsocket PUBLIC OpenSSL::SSL OpenSSL::Crypto)
|
||||||
elseif (USE_MBED_TLS)
|
elseif (USE_MBED_TLS)
|
||||||
message(STATUS "TLS configured to use mbedtls")
|
message(STATUS "TLS configured to use mbedtls")
|
||||||
|
|
||||||
find_package(MbedTLS REQUIRED)
|
find_package(MbedTLS REQUIRED)
|
||||||
target_include_directories(ixwebsocket PUBLIC ${MBEDTLS_INCLUDE_DIRS})
|
target_include_directories(ixwebsocket PUBLIC ${MBEDTLS_INCLUDE_DIRS})
|
||||||
target_link_libraries(ixwebsocket ${MBEDTLS_LIBRARIES})
|
target_link_libraries(ixwebsocket PUBLIC ${MBEDTLS_LIBRARIES})
|
||||||
elseif (USE_SECURE_TRANSPORT)
|
elseif (USE_SECURE_TRANSPORT)
|
||||||
message(STATUS "TLS configured to use secure transport")
|
message(STATUS "TLS configured to use secure transport")
|
||||||
target_link_libraries(ixwebsocket "-framework foundation" "-framework security")
|
target_link_libraries(ixwebsocket PUBLIC "-framework foundation" "-framework security")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -194,25 +194,25 @@ if (NOT ZLIB_FOUND)
|
|||||||
endif()
|
endif()
|
||||||
if (ZLIB_FOUND)
|
if (ZLIB_FOUND)
|
||||||
include_directories(${ZLIB_INCLUDE_DIRS})
|
include_directories(${ZLIB_INCLUDE_DIRS})
|
||||||
target_link_libraries(ixwebsocket ${ZLIB_LIBRARIES})
|
target_link_libraries(ixwebsocket PUBLIC ${ZLIB_LIBRARIES})
|
||||||
else()
|
else()
|
||||||
include_directories(third_party/zlib ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib)
|
include_directories(third_party/zlib ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib)
|
||||||
add_subdirectory(third_party/zlib)
|
add_subdirectory(third_party/zlib EXCLUDE_FROM_ALL)
|
||||||
target_link_libraries(ixwebsocket zlibstatic)
|
target_link_libraries(ixwebsocket PRIVATE $<LINK_ONLY:zlibstatic>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
target_link_libraries(ixwebsocket wsock32 ws2_32 shlwapi)
|
target_link_libraries(ixwebsocket PUBLIC wsock32 ws2_32 shlwapi)
|
||||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
|
|
||||||
if (USE_TLS)
|
if (USE_TLS)
|
||||||
target_link_libraries(ixwebsocket Crypt32)
|
target_link_libraries(ixwebsocket PUBLIC Crypt32)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
target_link_libraries(ixwebsocket ${CMAKE_THREAD_LIBS_INIT})
|
target_link_libraries(ixwebsocket PUBLIC ${CMAKE_THREAD_LIBS_INIT})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user