diff --git a/mesonbuild/compilers/__init__.py b/mesonbuild/compilers/__init__.py index 6b31ccac1..849e229f3 100644 --- a/mesonbuild/compilers/__init__.py +++ b/mesonbuild/compilers/__init__.py @@ -25,6 +25,7 @@ __all__ = [ 'ICC_STANDARD', 'ICC_WIN', + 'all_languages', 'base_options', 'clike_langs', 'c_suffixes', @@ -99,6 +100,7 @@ from .compilers import ( ICC_OSX, ICC_WIN, ICC_STANDARD, + all_languages, base_options, clike_langs, c_suffixes, diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index b61398fbe..a9ab29e81 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -45,6 +45,7 @@ lang_suffixes = { 'swift': ('swift',), 'java': ('java',), } +all_languages = lang_suffixes.keys() cpp_suffixes = lang_suffixes['cpp'] + ('h',) c_suffixes = lang_suffixes['c'] + ('h',) # List of languages that can be linked with C code directly by the linker diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py index 3da5dadac..7455c484e 100644 --- a/mesonbuild/optinterpreter.py +++ b/mesonbuild/optinterpreter.py @@ -20,21 +20,10 @@ from . import mparser from . import coredata from . import mesonlib from .interpreterbase import FeatureNew +from . import compilers forbidden_option_names = coredata.get_builtin_options() -forbidden_prefixes = {'c_', - 'cpp_', - 'd_', - 'rust_', - 'fortran_', - 'objc_', - 'objcpp_', - 'vala_', - 'csharp_', - 'swift_', - 'b_', - 'backend_', - } +forbidden_prefixes = [lang + '_' for lang in compilers.all_languages] + ['b_', 'backend_'] def is_invalid_name(name): if name in forbidden_option_names: