aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2020-05-11 17:41:20 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2020-05-12 20:45:06 +0300
commit956cba02224d5e38642c5fd298a290927a2cb358 (patch)
treee24ae4102f8032741ab451a575246d7d4fb62423
parentf29f3f9f28fbe143e9785ed54f088f004be704cd (diff)
downloadmeson-956cba02224d5e38642c5fd298a290927a2cb358.zip
meson-956cba02224d5e38642c5fd298a290927a2cb358.tar.gz
meson-956cba02224d5e38642c5fd298a290927a2cb358.tar.bz2
cmake: Ignore unknown c(pp)? stds (fixes #7104)
-rw-r--r--mesonbuild/cmake/interpreter.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/mesonbuild/cmake/interpreter.py b/mesonbuild/cmake/interpreter.py
index 125f18b..0a452d1 100644
--- a/mesonbuild/cmake/interpreter.py
+++ b/mesonbuild/cmake/interpreter.py
@@ -289,7 +289,15 @@ class ConverterTarget:
for j in self.compile_opts[i]:
m = ConverterTarget.std_regex.match(j)
if m:
- self.override_options += ['{}_std={}'.format(i, m.group(2))]
+ std = m.group(2)
+ if std not in self._all_lang_stds(i):
+ mlog.warning(
+ 'Unknown {}_std "{}" -> Ingoring. Try setting the project'
+ 'level {}_std if build errors occur.'.format(i, std),
+ once=True
+ )
+ continue
+ self.override_options += ['{}_std={}'.format(i, std)]
elif j in ['-fPIC', '-fpic', '-fPIE', '-fpie']:
self.pie = True
elif j in blacklist_compiler_flags:
@@ -539,6 +547,13 @@ class ConverterTarget:
suffixes += [x for x in exts]
return suffixes
+ @lru_cache(maxsize=None)
+ def _all_lang_stds(self, lang: str) -> T.List[str]:
+ lang_opts = self.env.coredata.compiler_options.build.get(lang, None)
+ if not lang_opts or 'std' not in lang_opts:
+ return []
+ return lang_opts['std'].choices
+
def process_inter_target_dependencies(self):
# Move the dependencies from all transfer_dependencies_from to the target
to_process = list(self.depends)