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 <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2025-07-06 21:05:56 +00:00
parent 5702bc5102
commit fac5d565aa
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
2 changed files with 4 additions and 1 deletions

View File

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

View File

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