From 0d7ea661cffcf88009ace53dc289c405e06e67c5 Mon Sep 17 00:00:00 2001
From: "L. E. Segovia" <amy@centricular.com>
Date: Thu, 3 Apr 2025 09:13:31 -0300
Subject: [PATCH] cmake: Fix using pkgconf for Windows cross builds

pkgconf has its own default logic on Windows for setting up a prefix,
which does not match the default behaviour of pkg-config (blindly
respecting modules' ${prefix} variable).

See
https://github.com/pkgconf/pkgconf/commit/dcf529b83d621ed09e99e41fc35fdffd068bd87a

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8768>
---
 subprojects/gstreamer/cmake/FindGStreamer.cmake | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/subprojects/gstreamer/cmake/FindGStreamer.cmake b/subprojects/gstreamer/cmake/FindGStreamer.cmake
index 80c5ce68d2..3dc1983324 100644
--- a/subprojects/gstreamer/cmake/FindGStreamer.cmake
+++ b/subprojects/gstreamer/cmake/FindGStreamer.cmake
@@ -90,6 +90,8 @@ endif()
 # Set the environment for pkg-config
 if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
     set(ENV{PKG_CONFIG_PATH} "${GStreamer_ROOT_DIR}/lib/pkgconfig;${GStreamer_ROOT_DIR}/lib/gstreamer-1.0/pkgconfig;${GStreamer_ROOT_DIR}/lib/gio/modules/pkgconfig")
+    # Block pkgconf's forced relocation for non-lib/pkgconfig modules on Windows -- https://github.com/pkgconf/pkgconf/commit/dcf529b83d621ed09e99e41fc35fdffd068bd87a
+    set(ENV{PKG_CONFIG_DONT_DEFINE_PREFIX} 1)
 else()
     set(ENV{PKG_CONFIG_PATH} "${GStreamer_ROOT_DIR}/lib/pkgconfig:${GStreamer_ROOT_DIR}/lib/gstreamer-1.0/pkgconfig:${GStreamer_ROOT_DIR}/lib/gio/modules/pkgconfig")
 endif()