external/meson/UnpackedTarball_meson.mk |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

New commits:
commit bbb3c95c6d6c10014443930008aeadf9cf9b557e
Author:     Christian Lohmaier <[email protected]>
AuthorDate: Fri Jan 23 12:24:05 2026 +0100
Commit:     Christian Lohmaier <[email protected]>
CommitDate: Fri Jan 23 15:38:57 2026 +0100

    meson: allow building with the older of two installed versions of VS
    
    meson always queries for the -latest -prerelease version of Visual
    Studio using vswhere, ignoring the selection done in configure. This
    then clashes when trying to build with an older version of the compiler.
    
    That's an obvious hack that only works with the provided version of
    meson and a better fix would be to make that a meson commandline option
    or allow passing it via the ENV/have it guess from CC/CXX or similar.
    
    Change-Id: I9bcbe26d9b1518b5effbf0be99329b8d2d4a0262
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197943
    Tested-by: Jenkins
    Reviewed-by: Christian Lohmaier <[email protected]>

diff --git a/external/meson/UnpackedTarball_meson.mk 
b/external/meson/UnpackedTarball_meson.mk
index 30be47b5eeba..b15b728d3dd3 100644
--- a/external/meson/UnpackedTarball_meson.mk
+++ b/external/meson/UnpackedTarball_meson.mk
@@ -11,4 +11,21 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,meson))
 
 $(eval $(call gb_UnpackedTarball_set_tarball,meson,$(MESON_TARBALL)))
 
+ifeq ($(OS),WNT)
+# hack to make meson use a specific VS version and not always the latest
+# (argument is '-latest' so inner quotes to separate the arguments
+# it also always specifies -prerelease, but that is left alone here)
+ifneq ($(filter 17.%,$(VCVER)),)
+meson_vsversion=-version', '[17,18)
+else ifneq ($(filter 18.%,$(VCVER)),)
+meson_vsversion=-version', '[18,19)
+else
+$(warning Warning: Unhandled VCVER '$(VCVER)'; defaulting meson to use latest 
VS version)
+meson_vsversion=-latest
+endif
+
+$(eval $(call gb_UnpackedTarball_set_post_action,meson,\
+    sed -i -e "s/-latest/$(meson_vsversion)/" mesonbuild/utils/vsenv.py \
+))
+endif
 # vim: set noet sw=4 ts=4:

Reply via email to