CUDA: Support _CMAKE_FEATURE_DETECTION_TARGET_TYPE like all other languages

This commit is contained in:
Robert Maynard
2026-06-25 13:22:02 -04:00
parent 23c5b40924
commit bd629722bd

View File

@@ -10,6 +10,12 @@ endif()
include(CMakeTestCompilerCommon)
# work around enforced code signing and / or missing executable target type
set(__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE})
if(_CMAKE_FEATURE_DETECTION_TARGET_TYPE)
set(CMAKE_TRY_COMPILE_TARGET_TYPE ${_CMAKE_FEATURE_DETECTION_TARGET_TYPE})
endif()
# Remove any cached result from an older CMake version.
# We now store this in CMakeCUDACompiler.cmake.
unset(CMAKE_CUDA_COMPILER_WORKS CACHE)
@@ -102,4 +108,6 @@ configure_file(
)
include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCUDACompiler.cmake)
set(CMAKE_TRY_COMPILE_TARGET_TYPE ${__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE})
unset(__CMAKE_SAVED_TRY_COMPILE_TARGET_TYPE)
unset(__CMAKE_CUDA_COMPILER_OUTPUT)