diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake index d05a8222bb..1eea0bd2da 100644 --- a/cmake/onnxruntime_unittests.cmake +++ b/cmake/onnxruntime_unittests.cmake @@ -41,7 +41,7 @@ function(AddTest) if (onnxruntime_USE_CUDA) # disable a warning from the CUDA headers about unreferenced local functions if (MSVC) - target_compile_options(onnxruntime_providers_cuda PRIVATE "$<$:SHELL:-Xcompiler /wd4505>" + target_compile_options(${_UT_TARGET} PRIVATE "$<$:-Xcompiler /wd4505>" "$<$>:/wd4505>") endif() endif()