diff --git a/ports/curl/portfile.cmake b/ports/curl/portfile.cmake index 6d3d7f0f56..e315d23a3d 100644 --- a/ports/curl/portfile.cmake +++ b/ports/curl/portfile.cmake @@ -175,6 +175,16 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) else() file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/curl-config ${CURRENT_PACKAGES_DIR}/debug/bin/curl-config) + + file(GLOB FILES LIST_DIRECTORIES TRUE ${CURRENT_PACKAGES_DIR}/bin/*) + if (FILES STREQUAL "") + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) + endif() + + file(GLOB FILES LIST_DIRECTORIES TRUE ${CURRENT_PACKAGES_DIR}/debug/bin/*) + if (FILES STREQUAL "") + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) + endif() endif() file(READ ${CURRENT_PACKAGES_DIR}/include/curl/curl.h CURL_H) diff --git a/ports/curl/vcpkg-cmake-wrapper.cmake b/ports/curl/vcpkg-cmake-wrapper.cmake index 8e8ff2938d..91678e7a81 100644 --- a/ports/curl/vcpkg-cmake-wrapper.cmake +++ b/ports/curl/vcpkg-cmake-wrapper.cmake @@ -23,11 +23,17 @@ if(TARGET CURL::libcurl) if (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") get_target_property(_curl_location_debug CURL::libcurl IMPORTED_IMPLIB_DEBUG) get_target_property(_curl_location_release CURL::libcurl IMPORTED_IMPLIB_RELEASE) - else() + endif() + + if(NOT _curl_location_debug AND NOT _curl_location_release) get_target_property(_curl_location_debug CURL::libcurl IMPORTED_LOCATION_DEBUG) get_target_property(_curl_location_release CURL::libcurl IMPORTED_LOCATION_RELEASE) endif() + if(NOT _curl_link_libraries) + set(_curl_link_libraries) + endif() + set(CURL_INCLUDE_DIRS "${_curl_include_dirs}") set(CURL_LIBRARY_DEBUG "${_curl_location_debug}") set(CURL_LIBRARY_RELEASE "${_curl_location_release}") @@ -38,4 +44,9 @@ if(TARGET CURL::libcurl) set(CURL_LIBRARIES ${CURL_LIBRARY} ${_curl_link_libraries}) set(CURL_VERSION_STRING "${CURL_VERSION}") + + set(_curl_include_dirs) + set(_curl_link_libraries) + set(_curl_location_debug) + set(_curl_location_release) endif() diff --git a/ports/curlpp/portfile.cmake b/ports/curlpp/portfile.cmake index aaa9c51ab0..da5177f904 100644 --- a/ports/curlpp/portfile.cmake +++ b/ports/curlpp/portfile.cmake @@ -31,7 +31,6 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL static) ) configure_file( - ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake ${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT} @ONLY ) diff --git a/ports/curlpp/vcpkg-cmake-wrapper.cmake b/ports/curlpp/vcpkg-cmake-wrapper.cmake deleted file mode 100644 index 0bffdc6b43..0000000000 --- a/ports/curlpp/vcpkg-cmake-wrapper.cmake +++ /dev/null @@ -1,35 +0,0 @@ -_find_package(${ARGS}) - -if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static") - if(TARGET unofficial::curlpp::curlpp) - # Fix CURL dependencies. See: - # https://github.com/Microsoft/vcpkg/issues/4312 - - set(_libs "") - - find_package(CURL REQUIRED) - - set(ZLIB_ROOT ${CMAKE_PREFIX_PATH}) # Prefer Zlib installed via `vcpkg` - find_package(ZLIB) - unset(ZLIB_ROOT) - - list(APPEND _libs ${CURL_LIBRARIES} ZLIB::ZLIB) - - find_package(OpenSSL QUIET) - if(OPENSSL_FOUND) - list(APPEND _libs OpenSSL::SSL OpenSSL::Crypto) - endif() - - find_package(Threads REQUIRED) - list(APPEND _libs Threads::Threads) - - if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") - list(APPEND _libs Ws2_32 Crypt32) - endif() - - set_target_properties( - unofficial::curlpp::curlpp - PROPERTIES INTERFACE_LINK_LIBRARIES "${_libs}" - ) - endif() -endif()