diff --git a/libcudacxx/test/utils/libcudacxx/test/config.py b/libcudacxx/test/utils/libcudacxx/test/config.py index 8c59890441..bd55a9c579 100644 --- a/libcudacxx/test/utils/libcudacxx/test/config.py +++ b/libcudacxx/test/utils/libcudacxx/test/config.py @@ -708,6 +708,7 @@ def configure_compile_flags(self): def configure_default_compile_flags(self): nvcc_host_compiler = self.get_lit_conf('nvcc_host_compiler') + if nvcc_host_compiler and self.cxx.type == 'nvcc': self.cxx.compile_flags += ['-ccbin={0}'.format(nvcc_host_compiler)] @@ -761,10 +762,20 @@ def configure_default_compile_flags(self): if std: # We found a dialect flag. + stdflag = '-std={0}'.format(std) if self.cxx.type == 'msvc': - self.cxx.compile_flags += ['/std:{0}'.format(std)] - else: - self.cxx.compile_flags += ['-std={0}'.format(std)] + stdflag = '/std:{0}'.format(std) + + extraflags = [] + if self.cxx.type == 'clang': + extraflags = ['-Wno-unknown-cuda-version'] + + # Do a check with the user/config flag to ensure that the flag is supported. + if not self.cxx.hasCompileFlag([stdflag] + extraflags): + raise OSError("Configured compiler does not support flag {0}".format(stdflag)) + + self.cxx.flags += [stdflag] + if not std: # There is no dialect flag. This happens with older MSVC. if self.cxx.type == 'nvcc':