diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index b315b346f7b05..ffc7c33ba3a52 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -920,6 +920,14 @@ function(onnxruntime_configure_target target_name) target_link_options(${target_name} PRIVATE "/CETCOMPAT") endif() + # https://stackoverflow.com/questions/48162570/cmake-how-to-set-compile-flags-for-header-files + if(NOT MSVC) + add_library(onnx_pb_headers INTERFACE) + message(STATUS, "${CMAKE_CURRENT_BINARY_DIR}") + target_include_directories(onnx_pb_headers INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/_deps/onnx-src/onnx) + target_compile_options(onnx_pb_headers INTERFACE $<$:-Wno-unused-parameter>) + target_link_libraries(${target_name} PUBLIC onnx_pb_headers) + endif() endfunction() function(onnxruntime_add_shared_library target_name)