fix: OpenSSL: Need to add openssl/applink.c to Windows executables using OpenSSL #4864

This commit is contained in:
Günter Obiltschnig
2025-02-08 10:29:31 +01:00
parent ca969f9ec3
commit 605baa13d2
11 changed files with 35 additions and 11 deletions

View File

@@ -216,12 +216,18 @@ option(POCO_UNBUNDLED
if(ENABLE_TESTS) if(ENABLE_TESTS)
include(CTest) include(CTest)
enable_testing() enable_testing()
message(STATUS "Building with unittests & samples") message(STATUS "Building with unit tests")
if(ENABLE_TEST_DEPRECATED) if(ENABLE_TEST_DEPRECATED)
add_compile_definitions(POCO_TEST_DEPRECATED) add_compile_definitions(POCO_TEST_DEPRECATED)
endif() endif()
else() else()
message(STATUS "Building without tests & samples") message(STATUS "Building without unit tests")
endif()
if(ENABLE_SAMPLES)
message(STATUS "Building with samples")
else()
message(STATUS "Building without samples")
endif() endif()
if(ENABLE_FUZZING) if(ENABLE_FUZZING)

View File

@@ -1,2 +1,5 @@
add_executable(genrsakey src/genrsakey.cpp) add_executable(genrsakey src/genrsakey.cpp)
target_link_libraries(genrsakey PUBLIC Poco::Crypto Poco::Util Poco::XML) target_link_libraries(genrsakey PUBLIC Poco::Crypto Poco::Util Poco::XML)
if(MSVC)
target_link_libraries(genrsakey PRIVATE OpenSSL::applink)
endif()

View File

@@ -26,6 +26,9 @@ else()
set_tests_properties(Crypto PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) set_tests_properties(Crypto PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
endif() endif()
target_link_libraries(Crypto-testrunner PUBLIC Poco::NetSSL Poco::XML CppUnit) target_link_libraries(Crypto-testrunner PUBLIC Poco::NetSSL Poco::XML CppUnit)
if(MSVC)
target_link_libraries(Crypto-testrunner PRIVATE OpenSSL::applink)
endif()
if(UNIX AND NOT ANDROID) if(UNIX AND NOT ANDROID)
target_link_libraries(Crypto-testrunner PUBLIC pthread) target_link_libraries(Crypto-testrunner PUBLIC pthread)
endif(UNIX AND NOT ANDROID) endif(UNIX AND NOT ANDROID)

View File

@@ -9,11 +9,6 @@
#include "Poco/Platform.h" #include "Poco/Platform.h"
// see https://www.openssl.org/docs/faq.html
// and https://github.com/openssl/openssl/blob/master/doc/man3/OPENSSL_Applink.pod
#if defined(POCO_OS_FAMILY_WINDOWS) && defined(OPENSSL_REQUIRE_APPLINK)
#include "openssl/applink.c"
#endif
#include "CryptoTestSuite.h" #include "CryptoTestSuite.h"
#include "CryptoTest.h" #include "CryptoTest.h"
#include "RSATest.h" #include "RSATest.h"

View File

@@ -26,6 +26,9 @@ else()
set_tests_properties(JWT PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR}) set_tests_properties(JWT PROPERTIES ENVIRONMENT POCO_BASE=${CMAKE_SOURCE_DIR})
endif() endif()
target_link_libraries(JWT-testrunner PUBLIC Poco::JWT Poco::Crypto CppUnit) target_link_libraries(JWT-testrunner PUBLIC Poco::JWT Poco::Crypto CppUnit)
if(MSVC)
target_link_libraries(JWT-testrunner PRIVATE OpenSSL::applink)
endif()
if(UNIX AND NOT ANDROID) if(UNIX AND NOT ANDROID)
target_link_libraries(JWT-testrunner PUBLIC pthread) target_link_libraries(JWT-testrunner PUBLIC pthread)
endif(UNIX AND NOT ANDROID) endif(UNIX AND NOT ANDROID)

View File

@@ -1,2 +1,5 @@
add_executable(HTTPSTimeServer src/HTTPSTimeServer.cpp) add_executable(HTTPSTimeServer src/HTTPSTimeServer.cpp)
target_link_libraries(HTTPSTimeServer PUBLIC Poco::NetSSL Poco::Util Poco::XML) target_link_libraries(HTTPSTimeServer PUBLIC Poco::NetSSL Poco::Util Poco::XML)
if(MSVC)
target_link_libraries(HTTPSTimeServer PRIVATE OpenSSL::applink)
endif()

View File

@@ -1,2 +1,5 @@
add_executable(Mail-ssl src/Mail.cpp) add_executable(Mail-ssl src/Mail.cpp)
target_link_libraries(Mail-ssl PUBLIC Poco::NetSSL Poco::Util Poco::XML) target_link_libraries(Mail-ssl PUBLIC Poco::NetSSL Poco::Util Poco::XML)
if(MSVC)
target_link_libraries(Mail-ssl PRIVATE OpenSSL::applink)
endif()

View File

@@ -1,5 +1,5 @@
add_executable(SetSourceIP src/SetSourceIP.cpp) add_executable(SetSourceIP src/SetSourceIP.cpp)
target_link_libraries(SetSourceIP PUBLIC Poco::NetSSL Poco::Crypto Poco::Util Poco::Net Poco::XML Poco::Foundation) target_link_libraries(SetSourceIP PUBLIC Poco::NetSSL Poco::Crypto Poco::Util Poco::Net Poco::XML Poco::Foundation)
# uncomment following line, might solve compiling issues if(MSVC)
#set(CMAKE_CXX_STANDARD 11) target_link_libraries(SetSourceIP PRIVATE OpenSSL::applink)
endif()

View File

@@ -3,3 +3,6 @@ add_executable(TwitterCLient
src/Twitter.cpp src/Twitter.cpp
) )
target_link_libraries(TwitterCLient PUBLIC Poco::NetSSL Poco::Util Poco::JSON Poco::XML) target_link_libraries(TwitterCLient PUBLIC Poco::NetSSL Poco::Util Poco::JSON Poco::XML)
if(MSVC)
target_link_libraries(TwitterClient PRIVATE OpenSSL::applink)
endif()

View File

@@ -1,2 +1,5 @@
add_executable(download-ssl src/download.cpp) add_executable(download-ssl src/download.cpp)
target_link_libraries(download-ssl PUBLIC Poco::NetSSL Poco::Util Poco::XML) target_link_libraries(download-ssl PUBLIC Poco::NetSSL Poco::Util Poco::XML)
if(MSVC)
target_link_libraries(download-ssl PRIVATE OpenSSL::applink)
endif()

View File

@@ -35,7 +35,9 @@ else()
) )
endif() endif()
target_link_libraries(NetSSL-testrunner PUBLIC Poco::NetSSL Poco::Util Poco::XML CppUnit) target_link_libraries(NetSSL-testrunner PUBLIC Poco::NetSSL Poco::Util Poco::XML CppUnit)
if(MSVC)
target_link_libraries(NetSSL-testrunner PRIVATE OpenSSL::applink)
endif()
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/ping/websocket-server.cpp) if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/ping/websocket-server.cpp)
add_executable(NetSSL-server ping/websocket-server.cpp) add_executable(NetSSL-server ping/websocket-server.cpp)