diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index d221343c..1a331460 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -3,8 +3,13 @@ if(NOT BUILD_TESTING) endif() if (OQS_PROVIDER_BUILD_STATIC) + get_filename_component(OPENSSL_LIB_TYPE ${OPENSSL_CRYPTO_LIBRARY} LAST_EXT) add_executable(example_static_oqsprovider static_oqsprovider.c) - target_link_libraries(example_static_oqsprovider PRIVATE ${OPENSSL_CRYPTO_LIBRARY} oqsprovider) + if(OPENSSL_LIB_TYPE STREQUAL ".a") + target_link_libraries(example_static_oqsprovider PRIVATE ${OPENSSL_CRYPTO_LIBRARY} oqsprovider) + else() + target_link_libraries(example_static_oqsprovider PRIVATE ${OPENSSL_CRYPTO_LIBRARY} oqsprovider dl pthread ) + endif() targets_set_static_provider(example_static_oqsprovider) add_test(NAME test_example_static_oqsprovider COMMAND example_static_oqsprovider) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 50a85d34..53ec05cb 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -27,8 +27,16 @@ set_tests_properties(oqs_signatures ) endif() +set(REQ_LIBS_T, "") +if (OQS_PROVIDER_BUILD_STATIC) + get_filename_component(OPENSSL_LIB_TYPE ${OPENSSL_CRYPTO_LIBRARY} LAST_EXT) + if(OPENSSL_LIB_TYPE STREQUAL ".a") + set(REQ_LIBS_T "dl" "pthread") + endif() +endif() + add_executable(oqs_test_signatures oqs_test_signatures.c test_common.c) -target_link_libraries(oqs_test_signatures PRIVATE ${OPENSSL_CRYPTO_LIBRARY} ${OQS_ADDL_SOCKET_LIBS}) +target_link_libraries(oqs_test_signatures PRIVATE ${OPENSSL_CRYPTO_LIBRARY} ${OQS_ADDL_SOCKET_LIBS} ${REQ_LIBS_T}) add_test( NAME oqs_kems @@ -49,7 +57,7 @@ set_tests_properties(oqs_kems endif() add_executable(oqs_test_kems oqs_test_kems.c test_common.c) -target_link_libraries(oqs_test_kems PRIVATE ${OPENSSL_CRYPTO_LIBRARY} ${OQS_ADDL_SOCKET_LIBS}) +target_link_libraries(oqs_test_kems PRIVATE ${OPENSSL_CRYPTO_LIBRARY} ${OQS_ADDL_SOCKET_LIBS} ${REQ_LIBS_T}) add_test( NAME oqs_groups @@ -70,7 +78,7 @@ set_tests_properties(oqs_groups ) endif() add_executable(oqs_test_groups oqs_test_groups.c test_common.c tlstest_helpers.c) -target_link_libraries(oqs_test_groups PRIVATE ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ${OQS_ADDL_SOCKET_LIBS}) +target_link_libraries(oqs_test_groups PRIVATE ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ${OQS_ADDL_SOCKET_LIBS} ${REQ_LIBS_T}) add_test( NAME oqs_tlssig @@ -92,10 +100,10 @@ set_tests_properties(oqs_tlssig ) endif() add_executable(oqs_test_tlssig oqs_test_tlssig.c test_common.c tlstest_helpers.c) -target_link_libraries(oqs_test_tlssig PRIVATE ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ${OQS_ADDL_SOCKET_LIBS}) +target_link_libraries(oqs_test_tlssig PRIVATE ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ${OQS_ADDL_SOCKET_LIBS} ${REQ_LIBS_T}) add_executable(oqs_test_endecode oqs_test_endecode.c test_common.c) -target_link_libraries(oqs_test_endecode PRIVATE ${OPENSSL_CRYPTO_LIBRARY} ${OQS_ADDL_SOCKET_LIBS}) +target_link_libraries(oqs_test_endecode PRIVATE ${OPENSSL_CRYPTO_LIBRARY} ${OQS_ADDL_SOCKET_LIBS} ${REQ_LIBS_T}) add_test( NAME oqs_endecode COMMAND oqs_test_endecode @@ -116,7 +124,7 @@ endif() add_executable(oqs_test_evp_pkey_params oqs_test_evp_pkey_params.c test_common.c) target_include_directories(oqs_test_evp_pkey_params PRIVATE "../oqsprov") -target_link_libraries(oqs_test_evp_pkey_params PRIVATE ${OPENSSL_CRYPTO_LIBRARY} ${OQS_ADDL_SOCKET_LIBS}) +target_link_libraries(oqs_test_evp_pkey_params PRIVATE ${OPENSSL_CRYPTO_LIBRARY} ${OQS_ADDL_SOCKET_LIBS} ${REQ_LIBS_T}) add_test( NAME oqs_evp_pkey_params COMMAND oqs_test_evp_pkey_params