summaryrefslogtreecommitdiff
path: root/dev-build/meson/files/0001-Only-convert-boolean-values-for-cmake-formats.patch
blob: 394b1bbb7c1bedc25954f32e8f97f16e13ed699a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From 9016e6958bb83feb9a724f20d8badb116bf7c5f2 Mon Sep 17 00:00:00 2001
From: Jan200101 <sentrycraft123@gmail.com>
Date: Tue, 21 Nov 2023 08:42:56 +0100
Subject: [PATCH] Only convert boolean values for cmake formats

This caused a regression with mesondefine where
  `conf_data.set("FOO", true)`
turned into
  `#define FOO 1`
instead of
  `#define FOO`
---
 mesonbuild/utils/universal.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mesonbuild/utils/universal.py b/mesonbuild/utils/universal.py
index 26194628c..93e64c0a2 100644
--- a/mesonbuild/utils/universal.py
+++ b/mesonbuild/utils/universal.py
@@ -1210,7 +1210,7 @@ def do_replacement(regex: T.Pattern[str], line: str,
                 var, _ = confdata.get(varname)
                 if isinstance(var, str):
                     var_str = var
-                elif isinstance(var, bool):
+                elif variable_format.startswith("cmake") and isinstance(var, bool):
                     var_str = str(int(var))
                 elif isinstance(var, int):
                     var_str = str(var)
-- 
2.41.0