From fac5d565aac96b2a553a30c33a4ab4063f567cdd Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Sun, 6 Jul 2025 21:05:56 +0000 Subject: [PATCH] build: use vcpkg host pkgconf when cross compiling For vcpkg, set `PKG_CONFIG_EXECUTABLE` to the host `pkgconf.exe` when the host is x64. Signed-off-by: Rafael Kitover --- cmake/Options.cmake | 4 ++++ cmake/Set-Toolchain-vcpkg.cmake | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/Options.cmake b/cmake/Options.cmake index 0f1662e4..bef66c4c 100644 --- a/cmake/Options.cmake +++ b/cmake/Options.cmake @@ -89,6 +89,10 @@ if(APPLE AND NOT DISABLE_MACOS_PACKAGE_MANAGERS) include(MacPackageManagers) endif() +if(CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg" AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^([xX]86_64|[aA][mM][dD]64)$") + set(PKG_CONFIG_EXECUTABLE "$ENV{VCPKG_ROOT}/installed/x64-windows/tools/pkgconf/pkgconf.exe") +endif() + find_package(PkgConfig) # Link / SFML diff --git a/cmake/Set-Toolchain-vcpkg.cmake b/cmake/Set-Toolchain-vcpkg.cmake index 562a408c..46a9da84 100644 --- a/cmake/Set-Toolchain-vcpkg.cmake +++ b/cmake/Set-Toolchain-vcpkg.cmake @@ -28,7 +28,6 @@ if(NOT DEFINED VCPKG_TARGET_TRIPLET) if(path MATCHES "[Hh]ost[Xx]64") set(VCPKG_HOST_TRIPLET "x64-windows" CACHE STRING "Vcpkg host triplet" FORCE) set(VCPKG_USE_HOST_TOOLS ON CACHE BOOL "Use vcpkg host tools" FORCE) - break() endif() endforeach()