From 55c5d95e26d8feee922c79b3fed5aa3a178168f3 Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Tue, 22 Oct 2024 10:32:34 +0300 Subject: [PATCH] Support cross-compiling in the libmagic vcpkg port overlay, attempt 2. (#5338) TYPE: NO_HISTORY --- ports/libmagic/portfile.cmake | 14 +++++++------- ports/libmagic/vcpkg.json | 4 ++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ports/libmagic/portfile.cmake b/ports/libmagic/portfile.cmake index 7135ef3a915..c3647ebf0d8 100644 --- a/ports/libmagic/portfile.cmake +++ b/ports/libmagic/portfile.cmake @@ -31,11 +31,17 @@ file(COPY "${CMAKE_CURRENT_LIST_DIR}/unofficial-libmagic-config.cmake.in" DESTIN file(COPY "${CMAKE_CURRENT_LIST_DIR}/magic.def" DESTINATION "${SOURCE_PATH}/src") file(COPY "${CMAKE_CURRENT_LIST_DIR}/config.h" DESTINATION "${SOURCE_PATH}/src") +if(VCPKG_CROSSCOMPILING) + vcpkg_add_to_path(PREPEND "${CURRENT_HOST_INSTALLED_DIR}/tools/libmagic") +elseif(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + set(EXTRA_ARGS "ADD_BIN_TO_PATH") +endif() + vcpkg_cmake_configure( SOURCE_PATH ${SOURCE_PATH} ) -vcpkg_cmake_install() +vcpkg_cmake_install(${EXTRA_ARGS}) vcpkg_copy_pdbs() vcpkg_fixup_pkgconfig() vcpkg_copy_tools(TOOL_NAMES file AUTO_CLEAN) @@ -47,12 +53,6 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/${PORT}/man5") -if(VCPKG_CROSSCOMPILING) - vcpkg_add_to_path(PREPEND "${CURRENT_HOST_INSTALLED_DIR}/tools/libmagic/bin") -elseif(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - set(EXTRA_ARGS "ADD_BIN_TO_PATH") -endif() - if(VCPKG_LIBRARY_LINKAGE STREQUAL static) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") endif() diff --git a/ports/libmagic/vcpkg.json b/ports/libmagic/vcpkg.json index 63065b51aee..ffb866b4560 100644 --- a/ports/libmagic/vcpkg.json +++ b/ports/libmagic/vcpkg.json @@ -13,6 +13,10 @@ "name": "vcpkg-cmake-config", "host": true }, + { + "name": "libmagic", + "host": true + }, { "name": "dirent", "platform": "windows"