From bd629722bde1337917e8ceb312c18751bdd38dee Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 25 Jun 2026 13:22:02 -0400 Subject: [PATCH] CUDA: Support _CMAKE_FEATURE_DETECTION_TARGET_TYPE like all other languages --- Modules/CMakeTestCUDACompiler.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Modules/CMakeTestCUDACompiler.cmake b/Modules/CMakeTestCUDACompiler.cmake index 91bada0df1..dfea9031a3 100644 --- a/Modules/CMakeTestCUDACompiler.cmake +++ b/Modules/CMakeTestCUDACompiler.cmake @@ -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)