From 18ccf86a6ae4682ee40bcf61b3ae519d56fe0b49 Mon Sep 17 00:00:00 2001 From: Amin Ya Date: Mon, 2 Jun 2025 01:55:41 -0700 Subject: [PATCH] [cpp-restsdk] link cpprest without crypto libraries (#21348) These libraries aren't needed in the generated code. Cpprest doesn't need the crypto libraries directly. It uses OpenSSL --- .../cpp-rest-sdk-client/cmake-lists.mustache | 18 +----------------- .../petstore/cpp-restsdk/client/CMakeLists.txt | 18 +----------------- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache index c2076ca4ef2..7b7225cf8d2 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache @@ -59,23 +59,7 @@ target_include_directories(${PROJECT_NAME} $ ) -if (UNIX) - message(STATUS "Building client library for Linux/Unix") - if (BUILD_SHARED_LIBS) - target_link_libraries(${PROJECT_NAME} PUBLIC Boost::headers cpprestsdk::cpprest) - else() - find_library(CRYPTO_LIB crypto REQUIRED) - target_link_libraries(${PROJECT_NAME} PUBLIC Boost::headers cpprestsdk::cpprest ${CRYPTO_LIB}) - endif() -else() - message(STATUS "Building client library for Windows") - if (BUILD_SHARED_LIBS) - target_link_libraries(${PROJECT_NAME} PUBLIC Boost::headers cpprestsdk::cpprest) - else() - find_library(BCRYPT_LIB bcrypt REQUIRED) - target_link_libraries(${PROJECT_NAME} PUBLIC Boost::headers cpprestsdk::cpprest ${BCRYPT_LIB}) - endif() -endif() +target_link_libraries(${PROJECT_NAME} PUBLIC Boost::headers cpprestsdk::cpprest) configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" diff --git a/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt b/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt index 7ab8d11a434..150af05cb75 100644 --- a/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt +++ b/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt @@ -59,23 +59,7 @@ target_include_directories(${PROJECT_NAME} $ ) -if (UNIX) - message(STATUS "Building client library for Linux/Unix") - if (BUILD_SHARED_LIBS) - target_link_libraries(${PROJECT_NAME} PUBLIC Boost::headers cpprestsdk::cpprest) - else() - find_library(CRYPTO_LIB crypto REQUIRED) - target_link_libraries(${PROJECT_NAME} PUBLIC Boost::headers cpprestsdk::cpprest ${CRYPTO_LIB}) - endif() -else() - message(STATUS "Building client library for Windows") - if (BUILD_SHARED_LIBS) - target_link_libraries(${PROJECT_NAME} PUBLIC Boost::headers cpprestsdk::cpprest) - else() - find_library(BCRYPT_LIB bcrypt REQUIRED) - target_link_libraries(${PROJECT_NAME} PUBLIC Boost::headers cpprestsdk::cpprest ${BCRYPT_LIB}) - endif() -endif() +target_link_libraries(${PROJECT_NAME} PUBLIC Boost::headers cpprestsdk::cpprest) configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"