mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 02:53:10 +01:00
Add workarround to handle static OpenSSL libs on Windows with CMake, fix NetSSL_Win samples and testsuite (#1733)
* Add workarround to handle static OpenSSL libs on Windows with CMake * Fix NetSSL_Win samples and testsuite
This commit is contained in:
committed by
Aleksandar Fabijanic
parent
62af826c88
commit
3dfcc83257
@@ -64,9 +64,19 @@ option(ENABLE_MONGODB "Enable MongoDB" ON)
|
||||
option(ENABLE_PDF "Enable PDF" OFF)
|
||||
option(ENABLE_UTIL "Enable Util" ON)
|
||||
option(ENABLE_NET "Enable Net" ON)
|
||||
option(ENABLE_NETSSL "Enable NetSSL" ON)
|
||||
option(ENABLE_NETSSL_WIN "Enable NetSSL Windows" OFF)
|
||||
option(ENABLE_CRYPTO "Enable Crypto" ON)
|
||||
find_package(OpenSSL QUIET)
|
||||
if(OPENSSL_FOUND)
|
||||
option(ENABLE_NETSSL "Enable NetSSL" ON)
|
||||
option(ENABLE_CRYPTO "Enable Crypto" ON)
|
||||
else()
|
||||
option(ENABLE_NETSSL "Enable NetSSL" OFF)
|
||||
option(ENABLE_CRYPTO "Enable Crypto" OFF)
|
||||
endif()
|
||||
if(WIN32)
|
||||
option(ENABLE_NETSSL_WIN "Enable NetSSL Windows" ON)
|
||||
else()
|
||||
set(ENABLE_NETSSL_WIN OFF)
|
||||
endif()
|
||||
option(ENABLE_DATA "Enable Data" ON)
|
||||
option(ENABLE_DATA_SQLITE "Enable Data SQlite" ON)
|
||||
option(ENABLE_DATA_MYSQL "Enable Data MySQL" ON)
|
||||
@@ -185,6 +195,13 @@ endif(WIN32 AND ENABLE_NETSSL_WIN)
|
||||
if(ENABLE_NETSSL OR ENABLE_CRYPTO)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
if(OPENSSL_FOUND)
|
||||
if(MSVC)
|
||||
option(OPENSSL_IS_STATIC
|
||||
"Set to OFF|ON (default is OFF) if OpenSSL has beenbuild as static libraries" OFF)
|
||||
if(OPENSSL_IS_STATIC)
|
||||
list(APPEND OPENSSL_LIBRARIES ws2_32 Crypt32)
|
||||
endif()
|
||||
endif()
|
||||
include_directories("${OPENSSL_INCLUDE_DIR}")
|
||||
if(ENABLE_NETSSL)
|
||||
add_subdirectory(NetSSL_OpenSSL)
|
||||
|
||||
@@ -32,20 +32,11 @@ POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
if (WIN32)
|
||||
# FIXME:
|
||||
# add_subdirectory(testsuite)
|
||||
message(STATUS "############ FIXME: ${LIBNAME} add_subdirectory(testsuite)")
|
||||
else ()
|
||||
add_subdirectory(testsuite)
|
||||
endif ()
|
||||
endif ()
|
||||
if (ENABLE_SAMPLES)
|
||||
if (WIN32)
|
||||
# FIXME: Looks like the samples use crypto somehow?
|
||||
# add_subdirectory(samples)
|
||||
message(STATUS "############ FIXME: ${LIBNAME} add_subdirectory(samples)")
|
||||
else ()
|
||||
add_subdirectory(testsuite)
|
||||
add_subdirectory(samples)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
||||
@@ -4,4 +4,7 @@ set(LOCAL_SRCS "")
|
||||
aux_source_directory(src LOCAL_SRCS)
|
||||
|
||||
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
|
||||
target_link_libraries( ${SAMPLE_NAME} PocoNetSSLWin PocoCrypto PocoUtil PocoNet PocoXML PocoFoundation )
|
||||
target_link_libraries( ${SAMPLE_NAME} PocoNetSSLWin PocoUtil PocoNet PocoXML PocoFoundation )
|
||||
add_custom_command(TARGET ${SAMPLE_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/any.pfx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
||||
)
|
||||
|
||||
@@ -4,4 +4,4 @@ set(LOCAL_SRCS "")
|
||||
aux_source_directory(src LOCAL_SRCS)
|
||||
|
||||
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
|
||||
target_link_libraries( ${SAMPLE_NAME} PocoNetSSLWin PocoCrypto PocoUtil PocoNet PocoXML PocoFoundation )
|
||||
target_link_libraries( ${SAMPLE_NAME} PocoNetSSLWin PocoUtil PocoNet PocoXML PocoFoundation )
|
||||
|
||||
@@ -4,4 +4,4 @@ set(LOCAL_SRCS "")
|
||||
aux_source_directory(src LOCAL_SRCS)
|
||||
|
||||
add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} )
|
||||
target_link_libraries( ${SAMPLE_NAME} PocoNetSSLWin PocoCrypto PocoUtil PocoNet PocoXML PocoFoundation )
|
||||
target_link_libraries( ${SAMPLE_NAME} PocoNetSSLWin PocoUtil PocoNet PocoXML PocoFoundation )
|
||||
|
||||
@@ -18,11 +18,10 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE
|
||||
|
||||
add_executable( ${TESTUNIT} ${TEST_SRCS} )
|
||||
add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${TESTUNIT} -all)
|
||||
target_link_libraries( ${TESTUNIT} PocoNetSSL PocoCrypto PocoNet PocoUtil PocoXML PocoFoundation PocoCppUnit)
|
||||
target_link_libraries( ${TESTUNIT} PocoNetSSLWin PocoNet PocoUtil PocoXML PocoFoundation PocoCppUnit)
|
||||
|
||||
# The test is run in the build directory. So the test data is copied there too
|
||||
add_custom_command(TARGET ${TESTUNIT} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/any.pem ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/rootcert.pem ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/any.pfx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/testrunner.xml ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTUNIT}.xml
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user