I hit this as well with clang 18 from git pulled on 8/18.
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
_CMAKE_CUDA_WHOLE_FLAG
In my case in addition to adding to the cmake command line -DCMAKE_CUDA_ARCHITECTURES=75
I also had to add -DCMAKE_CUDA_FLAGS=-std=c++17
. The latter being due to the use of -std=gnu++17 by default by clang and inherited by cmake.
Apparently the error complaining about _CMAKE_CUDA_WHOLE_FLAG
comes up when the clang compiler fails on cmake’s internal try compile, which can be for a number of different reasons.
fedora 37, cmake 3.26.2