Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed ngraph_onnx_importer compatibility target creation for older cmake #7176

Merged
merged 1 commit into from
Aug 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions cmake/templates/ngraphConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,27 @@

@PACKAGE_INIT@

function(set_imported_global target)
get_target_property(IS_IMPORTED_GLOBAL ${target} IMPORTED_GLOBAL)
if (NOT IS_IMPORTED_GLOBAL)
set_target_properties(${target} PROPERTIES IMPORTED_GLOBAL TRUE)
endif()
endfunction()

if(NOT TARGET ngraph)
include("${CMAKE_CURRENT_LIST_DIR}/ngraphTargets.cmake")
set_imported_global(ngraph::ngraph)
set_imported_global(ngraph::frontend_manager)
endif()

set(ngraph_ngraph_FOUND ON)
set(NGRAPH_LIBRARIES ngraph::ngraph)

set(ngraph_onnx_ngraph_frontend_FOUND @NGRAPH_ONNX_FRONTEND_ENABLE@)
if (ngraph_onnx_ngraph_frontend_FOUND AND NOT TARGET onnx_ngraph_frontend AND NOT TARGET ngraph::onnx_importer)
set_imported_global(ngraph::onnx_ngraph_frontend)
add_library(ngraph::onnx_importer ALIAS ngraph::onnx_ngraph_frontend)

# ngraph::onnx_importer target and variables are deprecated
set(ngraph_onnx_importer_FOUND @NGRAPH_ONNX_FRONTEND_ENABLE@)
if(ngraph_onnx_importer_FOUND)
set(ONNX_IMPORTER_LIBRARIES ngraph::onnx_ngraph_frontend)
if(NOT TARGET ngraph::onnx_importer)
add_library(ngraph::onnx_importer INTERFACE IMPORTED)
set_target_properties(ngraph::onnx_importer PROPERTIES
INTERFACE_LINK_LIBRARIES ngraph::onnx_ngraph_frontend
)
endif()
endif()

set(ngraph_paddlepaddle_frontend_FOUND @NGRAPH_PDPD_FRONTEND_ENABLE@)
if(ngraph_paddlepaddle_frontend_FOUND AND NOT TARGET paddlepaddle_ngraph_frontend)
set_imported_global(ngraph::paddlepaddle_ngraph_frontend)
endif()

check_required_components(ngraph)