2

According to this question, it is possible to use c++17 with cuda by using clang. However, I couldn't find how to setup CMakeLists.txt to accomplish this.

I enable c++17 with

add_compile_options(-std=c++17)

Out of the box with the following

    enable_language(CUDA)

nvcc complains

nvcc fatal   : Value 'c++17' is not defined for option 'std'

Adding the following as suggested here

    set(CUDA_HOST_COMPILER clang++)
    set(CMAKE_CUDA_COMPILER /usr/bin/clang++)

clang to complain

clang: error: language not recognized: 'cu'
Rufus
  • 5,111
  • 4
  • 28
  • 45

1 Answers1

2

Try

set(CMAKE_CXX_STANDARD 17)
Hatted Rooster
  • 35,759
  • 6
  • 62
  • 122
  • dam it... why doesn't `nvcc` complain when I do `add_compile_options(-std=c++14)` though? – Rufus Oct 08 '20 at 09:33