diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake index 346f7a1c9a..3b8c8189e4 100644 --- a/cmake/onnxruntime_unittests.cmake +++ b/cmake/onnxruntime_unittests.cmake @@ -876,6 +876,11 @@ if (MSVC) "$<$>:/wd26451>") target_compile_options(onnxruntime_test_all PRIVATE "$<$:SHELL:--compiler-options /wd4244>" "$<$>:/wd4244>") + # Avoid the error for Win arm64 Release build. error C1128: number of sections exceeded object file format limit: compile with /bigobj + string(TOLOWER ${onnxruntime_target_platform} GEN_PLATFORM) + if (${GEN_PLATFORM} STREQUAL "arm64" AND "${CMAKE_BUILD_TYPE}" STREQUAL "Release") + target_compile_options(onnxruntime_test_all PRIVATE "/bigobj") + endif() else() target_compile_options(onnxruntime_test_all PRIVATE "-Wno-parentheses") endif()