diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake index 177bc4229df31..460736ff8506e 100644 --- a/cmake/onnxruntime_unittests.cmake +++ b/cmake/onnxruntime_unittests.cmake @@ -1228,6 +1228,11 @@ block() LIBS ${onnxruntime_provider_test_libs} DEPENDS ${onnxruntime_provider_test_deps} ) + if (UNIX AND (onnxruntime_USE_TENSORRT OR onnxruntime_USE_NV)) + # The test_main.cc includes NvInfer.h where it has many deprecated declarations + # simply ignore them for TensorRT EP build + set_property(TARGET onnxruntime_provider_test APPEND_STRING PROPERTY COMPILE_FLAGS "-Wno-deprecated-declarations") + endif() # enable dynamic plugin EP usage target_compile_definitions(onnxruntime_provider_test PRIVATE ORT_UNIT_TEST_ENABLE_DYNAMIC_PLUGIN_EP_USAGE)