From 6240fe128b4f17d6f70c66b446d758483e622b69 Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Tue, 9 Apr 2019 02:53:10 -0400 Subject: [PATCH] [curl] Fix `tool` feature (#5971) - Use appropriate EXECUTABLE_SUFFIX to support non-Windows platforms - Fixup `curl-target-release.cmake` to point to the new executable location (fixing the CURL::curl target) --- ports/curl/CONTROL | 2 +- ports/curl/portfile.cmake | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ports/curl/CONTROL b/ports/curl/CONTROL index dfa3f229ae..165fa596e5 100644 --- a/ports/curl/CONTROL +++ b/ports/curl/CONTROL @@ -1,5 +1,5 @@ Source: curl -Version: 7.61.1-3 +Version: 7.61.1-4 Build-Depends: zlib Description: A library for transferring data with URLs Default-Features: ssl diff --git a/ports/curl/portfile.cmake b/ports/curl/portfile.cmake index 534a54aea0..6264196d7e 100644 --- a/ports/curl/portfile.cmake +++ b/ports/curl/portfile.cmake @@ -107,10 +107,23 @@ endif() file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/curl RENAME copyright) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/curl.exe") +# the native CMAKE_EXECUTABLE_SUFFIX does not work in portfiles, so emulate it +if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") # Windows + set(EXECUTABLE_SUFFIX ".exe") +else() + set(EXECUTABLE_SUFFIX "") +endif() + +if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/curl${EXECUTABLE_SUFFIX}") file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/curl") - file(RENAME ${CURRENT_PACKAGES_DIR}/bin/curl.exe ${CURRENT_PACKAGES_DIR}/tools/curl/curl.exe) + file(RENAME "${CURRENT_PACKAGES_DIR}/bin/curl${EXECUTABLE_SUFFIX}" "${CURRENT_PACKAGES_DIR}/tools/curl/curl${EXECUTABLE_SUFFIX}") vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/curl) + + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(READ "${CURRENT_PACKAGES_DIR}/share/curl/curl-target-release.cmake" RELEASE_MODULE) + string(REPLACE "\${_IMPORT_PREFIX}/bin/curl${EXECUTABLE_SUFFIX}" "\${_IMPORT_PREFIX}/tools/curl/curl${EXECUTABLE_SUFFIX}" RELEASE_MODULE "${RELEASE_MODULE}") + file(WRITE "${CURRENT_PACKAGES_DIR}/share/curl/curl-target-release.cmake" "${RELEASE_MODULE}") + endif() endif() if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")