From f860de7a0fafd394fe5604dbc7805b525ce146bf Mon Sep 17 00:00:00 2001 From: Yi Zhang Date: Sat, 28 Jan 2023 19:51:26 +0800 Subject: [PATCH] try interface for headers --- cmake/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) 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)