diff --git a/ngraph/test/CMakeLists.txt b/ngraph/test/CMakeLists.txt index 6fbef735581714..acdabe9fb81ced 100644 --- a/ngraph/test/CMakeLists.txt +++ b/ngraph/test/CMakeLists.txt @@ -613,9 +613,6 @@ if (NGRAPH_ONNX_IMPORT_ENABLE AND NOT NGRAPH_USE_PROTOBUF_LITE) ${Protobuf_INCLUDE_DIRS}) target_compile_definitions(unit-test PRIVATE $) - - get_target_property(ONNX_IMPORTER_SRC_DIR onnx_importer SOURCE_DIR) - target_include_directories(unit-test PRIVATE ${ONNX_IMPORTER_SRC_DIR}/src) endif() if (OV_COMPILER_IS_CLANG) @@ -623,6 +620,9 @@ if (OV_COMPILER_IS_CLANG) endif() if (NGRAPH_ONNX_IMPORT_ENABLE) + get_target_property(ONNX_IMPORTER_SRC_DIR onnx_importer SOURCE_DIR) + target_include_directories(unit-test PRIVATE ${ONNX_IMPORTER_SRC_DIR}/src) + target_link_libraries(unit-test PRIVATE onnx_importer) endif() diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index d35947dca9e38b..a0a00af5321a1c 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -130,7 +130,7 @@ if(NGRAPH_PDPD_FRONTEND_ENABLE OR NGRAPH_ONNX_IMPORT_ENABLE) if(VERBOSE_BUILD) set(Protobuf_DEBUG ON) endif() - find_package(Protobuf REQUIRED) + find_package(Protobuf 3.9.0 REQUIRED) if(NGRAPH_USE_PROTOBUF_LITE) set(Protobuf_LIBRARIES protobuf::libprotobuf-lite) else() @@ -162,11 +162,6 @@ if(NGRAPH_PDPD_FRONTEND_ENABLE OR NGRAPH_ONNX_IMPORT_ENABLE) target_compile_options(${target} ${link_type} -Wno-undef) endif() endforeach() - - # version checks - if(protobuf_VERSION VERSION_LESS "3.9" AND NGRAPH_USE_PROTOBUF_LITE) - message(FATAL_ERROR "Minimum supported version of protobuf-lite library is 3.9.0 (provided ${protobuf_VERSION})") - endif() endif() # diff --git a/thirdparty/protobuf/CMakeLists.txt b/thirdparty/protobuf/CMakeLists.txt index f3cec9914a16f5..da562377b284b4 100644 --- a/thirdparty/protobuf/CMakeLists.txt +++ b/thirdparty/protobuf/CMakeLists.txt @@ -85,6 +85,10 @@ if(NGRAPH_USE_PROTOBUF_LITE) VISIBILITY_INLINES_HIDDEN OFF) endif() +if(protobuf_VERSION VERSION_LESS "3.9" AND NGRAPH_USE_PROTOBUF_LITE) + message(FATAL_ERROR "Minimum supported version of protobuf-lite library is 3.9.0 (provided ${protobuf_VERSION})") +endif() + if(ENABLE_LTO AND protobuf_VERSION VERSION_GREATER_EQUAL "3.8") message(WARNING "Protobuf in version 3.8.0+ can throw runtime exceptions if LTO is enabled.") endif()