Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

Fix standalone gflags search (#28930)

Maksim Doronin9972dc19450b
diff --git a/src/plugins/intel_npu/tools/compile_tool/cmake/standalone.cmake b/src/plugins/intel_npu/tools/compile_tool/cmake/standalone.cmake
index d64ecc0a864..74e6e403a2d 100644
--- a/src/plugins/intel_npu/tools/compile_tool/cmake/standalone.cmake
+++ b/src/plugins/intel_npu/tools/compile_tool/cmake/standalone.cmake
@@ -21,8 +21,9 @@ find_package(OpenVINO REQUIRED COMPONENTS Runtime)
# gflags is distributed in sources in OpenVINO packages so we need to build it explicitly
#
-if(EXISTS "${PACKAGE_PREFIX_DIR}/samples/cpp/thirdparty/gflags")
- add_subdirectory("${PACKAGE_PREFIX_DIR}/samples/cpp/thirdparty/gflags" gflags EXCLUDE_FROM_ALL)
+get_filename_component(OpenVINO_PACKAGE_DIR "${OpenVINO_DIR}/../.." REALPATH)
+if(EXISTS "${OpenVINO_PACKAGE_DIR}/samples/cpp/thirdparty/gflags")
+ add_subdirectory("${OpenVINO_PACKAGE_DIR}/samples/cpp/thirdparty/gflags" gflags EXCLUDE_FROM_ALL)
else()
find_package(gflags REQUIRED)
endif()
diff --git a/src/plugins/intel_npu/tools/protopipe/cmake/standalone.cmake b/src/plugins/intel_npu/tools/protopipe/cmake/standalone.cmake
index 090756f86c4..05db8f15322 100644
--- a/src/plugins/intel_npu/tools/protopipe/cmake/standalone.cmake
+++ b/src/plugins/intel_npu/tools/protopipe/cmake/standalone.cmake
@@ -29,7 +29,8 @@ if (NOT yaml-cpp_FOUND)
endif()
if (NOT gflags_FOUND)
- set(GFLAGS_SOURCES_PATH "${PACKAGE_PREFIX_DIR}/samples/cpp/thirdparty/gflags")
+ get_filename_component(OpenVINO_PACKAGE_DIR "${OpenVINO_DIR}/../.." REALPATH)
+ set(GFLAGS_SOURCES_PATH "${OpenVINO_PACKAGE_DIR}/samples/cpp/thirdparty/gflags")
message(STATUS "gflags package was not found. Trying to find source package in ${GFLAGS_SOURCES_PATH}.")
if(EXISTS ${GFLAGS_SOURCES_PATH})
message(STATUS "gflags source package found. gflags will be built from sources.")
diff --git a/src/plugins/intel_npu/tools/single-image-test/cmake/standalone.cmake b/src/plugins/intel_npu/tools/single-image-test/cmake/standalone.cmake
index fd7ece7e4d1..35b9860005e 100644
--- a/src/plugins/intel_npu/tools/single-image-test/cmake/standalone.cmake
+++ b/src/plugins/intel_npu/tools/single-image-test/cmake/standalone.cmake
@@ -27,8 +27,9 @@ add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../common" common EXCLUDE_FROM_ALL
# gflags is distributed in sources in OpenVINO packages so we need to build it explicitly
#
-if(EXISTS "${PACKAGE_PREFIX_DIR}/samples/cpp/thirdparty/gflags")
- add_subdirectory("${PACKAGE_PREFIX_DIR}/samples/cpp/thirdparty/gflags" gflags EXCLUDE_FROM_ALL)
+get_filename_component(OpenVINO_PACKAGE_DIR "${OpenVINO_DIR}/../.." REALPATH)
+if(EXISTS "${OpenVINO_PACKAGE_DIR}/samples/cpp/thirdparty/gflags")
+ add_subdirectory("${OpenVINO_PACKAGE_DIR}/samples/cpp/thirdparty/gflags" gflags EXCLUDE_FROM_ALL)
else()
find_package(gflags REQUIRED)
endif()