FindCUDAToolkit: Fix precondition for dependency on Threads

`FindThreads` requires that C or CXX be enabled.  Previously we were
only checking that `CMAKE_{C,CXX}_COMPILER` have been set, which does
not mean the languages have been enabled.
This commit is contained in:
Connor Baker
2025-02-15 20:00:06 -05:00
committed by Brad King
parent bbbf373fe8
commit c5d81a2468

View File

@@ -1203,7 +1203,7 @@ if(CUDAToolkit_FOUND)
# when CUDA language is disabled
if(NOT TARGET CUDA::cudart_static_deps)
add_library(CUDA::cudart_static_deps IMPORTED INTERFACE)
if(UNIX AND (CMAKE_C_COMPILER OR CMAKE_CXX_COMPILER))
if(UNIX AND (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED))
find_package(Threads REQUIRED)
target_link_libraries(CUDA::cudart_static_deps INTERFACE Threads::Threads ${CMAKE_DL_LIBS})
endif()