summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCUDACompiler.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/CMakeDetermineCUDACompiler.cmake')
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index daca382..85b6695 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -189,6 +189,10 @@ if(NOT CMAKE_CUDA_COMPILER_ID_RUN)
set(nvcc_test_flags "--keep --keep-dir tmp")
if(CMAKE_CUDA_HOST_COMPILER)
string(APPEND nvcc_test_flags " -ccbin=\"${CMAKE_CUDA_HOST_COMPILER}\"")
+
+ # If the user has specified a host compiler we should fail instead of trying without.
+ # Succeeding detection without may result in confusing errors later on, see #21076.
+ set(CMAKE_CUDA_COMPILER_ID_REQUIRE_SUCCESS ON)
endif()
elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
if(WIN32)