diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ae6eaeaf..acc5d117a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/NetSSL_Win/CMakeLists.txt b/NetSSL_Win/CMakeLists.txt index 527135765..d12b286fd 100644 --- a/NetSSL_Win/CMakeLists.txt +++ b/NetSSL_Win/CMakeLists.txt @@ -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 () - diff --git a/NetSSL_Win/samples/HTTPSTimeServer/CMakeLists.txt b/NetSSL_Win/samples/HTTPSTimeServer/CMakeLists.txt index ae5014ddb..c53f780bd 100644 --- a/NetSSL_Win/samples/HTTPSTimeServer/CMakeLists.txt +++ b/NetSSL_Win/samples/HTTPSTimeServer/CMakeLists.txt @@ -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} + ) diff --git a/NetSSL_Win/samples/Mail/CMakeLists.txt b/NetSSL_Win/samples/Mail/CMakeLists.txt index c6fa18840..634ce4a24 100644 --- a/NetSSL_Win/samples/Mail/CMakeLists.txt +++ b/NetSSL_Win/samples/Mail/CMakeLists.txt @@ -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 ) diff --git a/NetSSL_Win/samples/download/CMakeLists.txt b/NetSSL_Win/samples/download/CMakeLists.txt index b7a546005..7171bda37 100644 --- a/NetSSL_Win/samples/download/CMakeLists.txt +++ b/NetSSL_Win/samples/download/CMakeLists.txt @@ -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 ) diff --git a/NetSSL_Win/testsuite/CMakeLists.txt b/NetSSL_Win/testsuite/CMakeLists.txt index e3ca71508..44bba441b 100644 --- a/NetSSL_Win/testsuite/CMakeLists.txt +++ b/NetSSL_Win/testsuite/CMakeLists.txt @@ -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 )