cmake: prefer using find_package(InferenceEngine)
authorAlexander Alekhin <alexander.alekhin@intel.com>
Tue, 17 Jul 2018 12:30:56 +0000 (15:30 +0300)
committerAlexander Alekhin <alexander.alekhin@intel.com>
Tue, 17 Jul 2018 12:31:11 +0000 (15:31 +0300)
CMakeLists.txt
cmake/OpenCVDetectInferenceEngine.cmake

index 52a1081..898a837 100644 (file)
@@ -1408,7 +1408,17 @@ if(WITH_HALIDE OR HAVE_HALIDE)
 endif()
 
 if(WITH_INF_ENGINE OR HAVE_INF_ENGINE)
-  status("    Inference Engine:"     HAVE_INF_ENGINE     THEN "YES (${INF_ENGINE_LIBRARIES} ${INF_ENGINE_INCLUDE_DIRS})" ELSE NO)
+  if(HAVE_INF_ENGINE)
+    set(__msg "YES")
+    if(DEFINED INF_ENGINE_VERSION)
+      set(__msg "YES (ver ${INF_ENGINE_VERSION})")
+    endif()
+    status("    Inference Engine:" "${__msg}")
+    status("                libs:" "${INF_ENGINE_LIBRARIES}")
+    status("            includes:" "${INF_ENGINE_INCLUDE_DIRS}")
+  else()
+    status("    Inference Engine:"     "NO")
+  endif()
 endif()
 
 if(WITH_EIGEN OR HAVE_EIGEN)
index 1c248b1..366509e 100644 (file)
@@ -20,6 +20,15 @@ if(NOT HAVE_CXX11)
     ie_fail()
 endif()
 
+find_package(InferenceEngine QUIET)
+if(InferenceEngine_FOUND)
+  set(INF_ENGINE_LIBRARIES "${InferenceEngine_LIBRARIES}")
+  set(INF_ENGINE_INCLUDE_DIRS "${InferenceEngine_INCLUDE_DIRS}")
+  set(INF_ENGINE_VERSION "${InferenceEngine_VERSION}")
+  set(HAVE_INF_ENGINE TRUE)
+  return()
+endif()
+
 ocv_check_environment_variables(INTEL_CVSDK_DIR INF_ENGINE_ROOT_DIR IE_PLUGINS_PATH)
 
 if(NOT INF_ENGINE_ROOT_DIR OR NOT EXISTS "${INF_ENGINE_ROOT_DIR}/include/inference_engine.hpp")