diff --git a/cmake/OpenCVDetectInferenceEngine.cmake b/cmake/OpenCVDetectInferenceEngine.cmake index 205e3a19ff..ddbec9d514 100644 --- a/cmake/OpenCVDetectInferenceEngine.cmake +++ b/cmake/OpenCVDetectInferenceEngine.cmake @@ -29,13 +29,16 @@ function(add_custom_ie_build _inc _lib _lib_rel _lib_dbg _msg) INTERFACE_INCLUDE_DIRECTORIES "${_inc}" ) - find_library(ie_builder_custom_lib "inference_engine_nn_builder" PATHS "${INF_ENGINE_LIB_DIRS}" NO_DEFAULT_PATH) - if(EXISTS "${ie_builder_custom_lib}") - add_library(inference_engine_nn_builder UNKNOWN IMPORTED) - set_target_properties(inference_engine_nn_builder PROPERTIES - IMPORTED_LOCATION "${ie_builder_custom_lib}" - ) - endif() + set(custom_libraries "") + file(GLOB libraries "${INF_ENGINE_LIB_DIRS}/${CMAKE_SHARED_LIBRARY_PREFIX}inference_engine_*${CMAKE_SHARED_LIBRARY_SUFFIX}") + foreach(full_path IN LISTS libraries) + get_filename_component(library "${full_path}" NAME_WE) + string(REPLACE "${CMAKE_SHARED_LIBRARY_PREFIX}" "" library "${library}") + add_library(${library} UNKNOWN IMPORTED) + set_target_properties(${library} PROPERTIES + IMPORTED_LOCATION "${full_path}") + list(APPEND custom_libraries ${library}) + endforeach() if(NOT INF_ENGINE_RELEASE VERSION_GREATER "2018050000") find_library(INF_ENGINE_OMP_LIBRARY iomp5 PATHS "${INF_ENGINE_OMP_DIR}" NO_DEFAULT_PATH) @@ -46,12 +49,7 @@ function(add_custom_ie_build _inc _lib _lib_rel _lib_dbg _msg) endif() endif() set(INF_ENGINE_VERSION "Unknown" CACHE STRING "") - set(INF_ENGINE_TARGET inference_engine) - if(TARGET inference_engine_nn_builder) - list(APPEND INF_ENGINE_TARGET inference_engine_nn_builder) - set(_msg "${_msg}, with IE NN Builder API") - endif() - set(INF_ENGINE_TARGET "${INF_ENGINE_TARGET}" PARENT_SCOPE) + set(INF_ENGINE_TARGET "inference_engine;${custom_libraries}" PARENT_SCOPE) message(STATUS "Detected InferenceEngine: ${_msg}") endfunction()