[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)
This commit is contained in:
past-due 2019-04-09 02:53:10 -04:00 committed by Phil Christensen
parent b39b0899cb
commit 6240fe128b
2 changed files with 16 additions and 3 deletions

View File

@ -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

View File

@ -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")