From 2319dec27812c48688e7c5982c6b98ef8223f4be Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Mon, 18 May 2020 21:18:43 -0700 Subject: [PATCH] (cmake) revert CMake changes to fix #203 and be able to use an external OpenSSL --- CMakeLists.txt | 40 +++++++++++++------------------- docs/CHANGELOG.md | 4 ++++ ixwebsocket/IXWebSocketVersion.h | 2 +- 3 files changed, 21 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ad2a099..974a528a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,8 +153,6 @@ add_library( ixwebsocket STATIC ${IXWEBSOCKET_HEADERS} ) -add_library ( ixwebsocket::ixwebsocket ALIAS ixwebsocket ) - if (USE_TLS) target_compile_definitions(ixwebsocket PUBLIC IXWEBSOCKET_USE_TLS) if (USE_MBED_TLS) @@ -184,20 +182,22 @@ if (USE_TLS) # This OPENSSL_FOUND check is to help find a cmake manually configured OpenSSL if (NOT OPENSSL_FOUND) - include(FindOpenSSL) + find_package(OpenSSL REQUIRED) endif() message(STATUS "OpenSSL: " ${OPENSSL_VERSION}) - target_link_libraries(ixwebsocket PUBLIC OpenSSL::SSL OpenSSL::Crypto) + add_definitions(${OPENSSL_DEFINITIONS}) + target_include_directories(ixwebsocket PUBLIC ${OPENSSL_INCLUDE_DIR}) + target_link_libraries(ixwebsocket ${OPENSSL_LIBRARIES}) elseif (USE_MBED_TLS) message(STATUS "TLS configured to use mbedtls") find_package(MbedTLS REQUIRED) target_include_directories(ixwebsocket PUBLIC ${MBEDTLS_INCLUDE_DIRS}) - target_link_libraries(ixwebsocket PUBLIC ${MBEDTLS_LIBRARIES}) + target_link_libraries(ixwebsocket ${MBEDTLS_LIBRARIES}) elseif (USE_SECURE_TRANSPORT) message(STATUS "TLS configured to use secure transport") - target_link_libraries(ixwebsocket PUBLIC "-framework foundation" "-framework security") + target_link_libraries(ixwebsocket "-framework foundation" "-framework security") endif() endif() @@ -207,25 +207,25 @@ if (NOT ZLIB_FOUND) endif() if (ZLIB_FOUND) include_directories(${ZLIB_INCLUDE_DIRS}) - target_link_libraries(ixwebsocket PUBLIC ${ZLIB_LIBRARIES}) + target_link_libraries(ixwebsocket ${ZLIB_LIBRARIES}) else() include_directories(third_party/zlib ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib) - add_subdirectory(third_party/zlib EXCLUDE_FROM_ALL) - target_link_libraries(ixwebsocket PRIVATE $) + add_subdirectory(third_party/zlib) + target_link_libraries(ixwebsocket zlibstatic) endif() if (WIN32) - target_link_libraries(ixwebsocket PUBLIC wsock32 ws2_32 shlwapi) + target_link_libraries(ixwebsocket wsock32 ws2_32 shlwapi) add_definitions(-D_CRT_SECURE_NO_WARNINGS) if (USE_TLS) - target_link_libraries(ixwebsocket PUBLIC Crypt32) + target_link_libraries(ixwebsocket Crypt32) endif() endif() if (UNIX) find_package(Threads) - target_link_libraries(ixwebsocket PUBLIC ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(ixwebsocket ${CMAKE_THREAD_LIBS_INIT}) endif() @@ -238,23 +238,15 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") target_compile_options(ixwebsocket PRIVATE /MP) endif() -target_include_directories(ixwebsocket PUBLIC $ $) +target_include_directories(ixwebsocket PUBLIC ${IXWEBSOCKET_INCLUDE_DIRS}) set_target_properties(ixwebsocket PROPERTIES PUBLIC_HEADER "${IXWEBSOCKET_HEADERS}") -install(TARGETS ixwebsocket EXPORT ixwebsocket - ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ixwebsocket/ +install(TARGETS ixwebsocket + ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ixwebsocket/ ) -# This gets in the way of vcpkg in ways I do not know how to fix -# https://github.com/microsoft/vcpkg/pull/11030 -# Maybe using vcpkg_fixup_cmake_targets could fix it -if (INSTALL_CMAKE_FILE) - install(EXPORT ixwebsocket NAMESPACE ixwebsocket:: DESTINATION lib/cmake/ixwebsocket) - export(EXPORT ixwebsocket NAMESPACE ixwebsocket:: FILE ixwebsocketConfig.cmake) -endif() - if (USE_WS OR USE_TEST) add_subdirectory(ixcore) add_subdirectory(ixcrypto) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 90d62331..a485acb7 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All changes to this project will be documented in this file. +## [9.6.3] - 2020-05-18 + +(cmake) revert CMake changes to fix #203 and be able to use an external OpenSSL + ## [9.6.2] - 2020-05-17 (cmake) make install cmake files optional to not conflict with vcpkg diff --git a/ixwebsocket/IXWebSocketVersion.h b/ixwebsocket/IXWebSocketVersion.h index 2827dad7..c1f4c4a5 100644 --- a/ixwebsocket/IXWebSocketVersion.h +++ b/ixwebsocket/IXWebSocketVersion.h @@ -6,4 +6,4 @@ #pragma once -#define IX_WEBSOCKET_VERSION "9.6.2" +#define IX_WEBSOCKET_VERSION "9.6.3"