From 0dce91c12aa2477ffe0bbefe3cce28f251fdafcb Mon Sep 17 00:00:00 2001 From: vurusovs Date: Fri, 28 May 2021 13:40:43 +0300 Subject: [PATCH] Make timetests dependent on IE gflags 3rdparty from samples/ --- .../src/timetests_helper/CMakeLists.txt | 40 ++++++++++++++----- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/tests/time_tests/src/timetests_helper/CMakeLists.txt b/tests/time_tests/src/timetests_helper/CMakeLists.txt index 0e474ce1a335a2..6d396f497d6c4e 100644 --- a/tests/time_tests/src/timetests_helper/CMakeLists.txt +++ b/tests/time_tests/src/timetests_helper/CMakeLists.txt @@ -8,16 +8,36 @@ file (GLOB SRC *.cpp) add_library(${TARGET_NAME} STATIC ${SRC}) target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_SOURCE_DIR}/include") -include(FetchContent) -FetchContent_Declare( - gflags - GIT_REPOSITORY "https://github.com/gflags/gflags.git" - GIT_TAG "v2.2.2" -) -FetchContent_GetProperties(gflags) -if(NOT gflags_POPULATED) - FetchContent_Populate(gflags) - add_subdirectory(${gflags_SOURCE_DIR} ${gflags_BINARY_DIR}) + +set(OpenVINO_MAIN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../") + +if (NOT TARGET IE::inference_engine) + find_package(IEDevScripts REQUIRED + PATHS "${OpenVINO_MAIN_SOURCE_DIR}/cmake/developer_package" + NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH) +endif() + + +set (GFLAGS_IS_SUBPROJECT TRUE) +set (HAVE_SYS_STAT_H 1) +set (HAVE_INTTYPES_H 1) +set (INTTYPES_FORMAT C99) +set (BUILD_TESTING OFF) + +if(EXISTS "${OpenVINO_MAIN_SOURCE_DIR}/inference-engine/samples/thirdparty/gflags") + function(add_gflags) + if(NOT WIN32) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-all") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-all") + endif() + set(BUILD_SHARED_LIBS OFF) + add_subdirectory(${OpenVINO_MAIN_SOURCE_DIR}/inference-engine/samples/thirdparty/gflags + ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + EXCLUDE_FROM_ALL) + set_target_properties(gflags_nothreads_static PROPERTIES FOLDER thirdparty) + endfunction() + add_gflags() endif() target_link_libraries(${TARGET_NAME} gflags)