diff --git a/src/frontends/onnx/frontend/CMakeLists.txt b/src/frontends/onnx/frontend/CMakeLists.txt index d298cacdc47acd..d3494fc42b4e16 100644 --- a/src/frontends/onnx/frontend/CMakeLists.txt +++ b/src/frontends/onnx/frontend/CMakeLists.txt @@ -77,6 +77,11 @@ ov_add_frontend(NAME onnx FILEDESCRIPTION "FrontEnd to load and convert ONNX file format" LINK_LIBRARIES openvino_onnx_common openvino::core::dev) +# Required to build it in a strict order in case onnx_common contains onnx headers +if(NOT ONNX_FOUND) + add_dependencies(openvino_onnx_frontend openvino_onnx_common) +endif() + set(ONNX_OPSET_VERSION 21 CACHE INTERNAL "Supported version of ONNX operator set") target_compile_definitions(${TARGET_NAME} PRIVATE ONNX_OPSET_VERSION=${ONNX_OPSET_VERSION}) diff --git a/src/frontends/onnx/tests/CMakeLists.txt b/src/frontends/onnx/tests/CMakeLists.txt index 1f647fd3d5d2ac..97bae7db995da3 100644 --- a/src/frontends/onnx/tests/CMakeLists.txt +++ b/src/frontends/onnx/tests/CMakeLists.txt @@ -126,6 +126,7 @@ add_dependencies(ov_onnx_frontend_tests openvino_template_extension) # Working with ModelProto if(NOT ONNX_FOUND) + add_dependencies(ov_onnx_frontend_tests openvino_onnx_common) target_link_libraries(ov_onnx_frontend_tests PRIVATE openvino_onnx_common) endif()