do not repeat magic regexes for cmake define replacements

We already have this magic string in mesonlib, and this should always
have used the cmake@ format which is identical to the meson format other
than the regex.
pull/9469/head
Eli Schwartz 3 years ago committed by Xavier Claessens
parent f4b91c4306
commit 9ec3b99a4f
  1. 4
      mesonbuild/modules/cmake.py

@ -310,10 +310,10 @@ class CmakeModule(ExtensionModule):
raise mesonlib.MesonException(f'Could not read input file {infile}: {e!s}')
result = []
regex = re.compile(r'(?:\\\\)+(?=\\?@)|\\@|@([-a-zA-Z0-9_]+)@')
regex = mesonlib.get_variable_regex('cmake@')
for line in data:
line = line.replace('@PACKAGE_INIT@', package_init)
line, _missing = mesonlib.do_replacement(regex, line, 'meson', confdata)
line, _missing = mesonlib.do_replacement(regex, line, 'cmake@', confdata)
result.append(line)

Loading…
Cancel
Save