diff --git a/ports/libmagic/CMakeLists.txt b/ports/libmagic/CMakeLists.txt index e338d9a70e5..b610731d629 100644 --- a/ports/libmagic/CMakeLists.txt +++ b/ports/libmagic/CMakeLists.txt @@ -6,12 +6,9 @@ unset(CONFIGURE_AC_CONTENT) project(file VERSION ${CMAKE_MATCH_1}) -option(FILE_TESTS "Enable file tests" OFF) - # Get library directory for multiarch linux distros include(GNUInstallDirs) -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules") set(targets) find_package(PCRE2 CONFIG REQUIRED COMPONENTS 8BIT) if(WIN32 AND NOT MINGW) 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"