regression: 3.22 does not pass -std=c++14 to nvcc
In both 3.22.0
and 3.22.20220119-g58804d1
cmake fails to pass -std=c++14
to nvcc
when using clang 11 as host cxx compiler.
CMakeLists.txt
cmake_minimum_required(VERSION 3.18)
project(std_cuda CXX CUDA)
set(CMAKE_CXX_STANDARD 14)
add_library(std_cuda a.cu)
a.cu
#include <type_traits>
Current behavior
$ /path/to/cmake-master/bin/cmake .. -DCMAKE_CUDA_HOST_COMPILER=/usr/bin/clang++-10 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10 -DCMAKE_VERBOSE_MAKEFILE=1 >& /dev/null && make | grep nvcc
/path/to/bin/nvcc -forward-unknown-to-host-compiler -ccbin=/usr/bin/clang++-10 --generate-code=arch=compute_52,code=[compute_52,sm_52] -MD -MT CMakeFiles/std_cuda.dir/a.cu.o -MF CMakeFiles/std_cuda.dir/a.cu.o.d -x cu -c /tmp/tmp.w1RusGPDTz/a.cu -o CMakeFiles/std_cuda.dir/a.cu.o
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/type_traits:588:162: error: type-id cannot have a name
template< class _Tp> using __is_signed_integer = __is_one_of< __remove_cv_t< _Tp> , signed char, signed short, signed int, signed long, signed long long, signed __int128_t> ;
^
1 error generated.
On older versions of CMake:
$ /path/to/cmake-3.21.4/bin/cmake .. -DCMAKE_CUDA_HOST_COMPILER=/usr/bin/clang++-10 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10 -DCMAKE_VERBOSE_MAKEFILE=1 >& /dev/null && make | grep nvcc
/path/to/bin/nvcc -forward-unknown-to-host-compiler -ccbin=/usr/bin/clang++-10 --generate-code=arch=compute_52,code=[compute_52,sm_52] -std=c++14 -MD -MT CMakeFiles/std_cuda.dir/a.cu.o -MF CMakeFiles/std_cuda.dir/a.cu.o.d -x cu -c /tmp/tmp.w1RusGPDTz/a.cu -o CMakeFiles/std_cuda.dir/a.cu.o
If no flag is passed, the default -std=gnu++14
is used when nvcc invokes clang, which apparently is incompatible thanks to the __int128_t extension.
Note that when I set set(CMAKE_CXX_STANDARD 17)
, -std=c++17
is passed to nvcc, likely because CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT "14"
is default.
Edited by Harmen Stoppels