summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/cuda.py
diff options
context:
space:
mode:
authorCharles Brunet <charles.brunet@optelgroup.com>2024-01-11 15:20:44 -0500
committerDylan Baker <dylan@pnwbakers.com>2024-03-15 09:23:46 -0700
commitdacb25db101e7ede60b6ba3dd5a7d1935dc5ff73 (patch)
treeeef37958f0c54683829453d03d4e13bf5e02377f /mesonbuild/compilers/cuda.py
parentd08ef2c08bb0120f0ba20dbc10575b7e15577349 (diff)
downloadmeson-dacb25db101e7ede60b6ba3dd5a7d1935dc5ff73.tar.gz
Improve error messages for invalid option values
By adding the option name to UserOption object, it is now possible to display the name of the affected option when the given option value is not valid. Fixes #12635
Diffstat (limited to 'mesonbuild/compilers/cuda.py')
-rw-r--r--mesonbuild/compilers/cuda.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py
index 391107f84..ab4810798 100644
--- a/mesonbuild/compilers/cuda.py
+++ b/mesonbuild/compilers/cuda.py
@@ -630,10 +630,6 @@ class CudaCompiler(Compiler):
_CPP20_VERSION = '>=12.0'
def get_options(self) -> 'MutableKeyedOptionDictType':
- opts = super().get_options()
- std_key = OptionKey('std', machine=self.for_machine, lang=self.language)
- ccbindir_key = OptionKey('ccbindir', machine=self.for_machine, lang=self.language)
-
cpp_stds = ['none', 'c++03', 'c++11']
if version_compare(self.version, self._CPP14_VERSION):
cpp_stds += ['c++14']
@@ -642,13 +638,18 @@ class CudaCompiler(Compiler):
if version_compare(self.version, self._CPP20_VERSION):
cpp_stds += ['c++20']
- opts.update({
- std_key: coredata.UserComboOption('C++ language standard to use with CUDA',
- cpp_stds, 'none'),
- ccbindir_key: coredata.UserStringOption('CUDA non-default toolchain directory to use (-ccbin)',
- ''),
- })
- return opts
+ return self.update_options(
+ super().get_options(),
+ self.create_option(coredata.UserComboOption,
+ OptionKey('std', machine=self.for_machine, lang=self.language),
+ 'C++ language standard to use with CUDA',
+ cpp_stds,
+ 'none'),
+ self.create_option(coredata.UserStringOption,
+ OptionKey('ccbindir', machine=self.for_machine, lang=self.language),
+ 'CUDA non-default toolchain directory to use (-ccbin)',
+ ''),
+ )
def _to_host_compiler_options(self, options: 'KeyedOptionDictType') -> 'KeyedOptionDictType':
"""