diff --git a/tests/time_tests/CMakeLists.txt b/tests/time_tests/CMakeLists.txt index 4175c7f5503..0a208187aaf 100644 --- a/tests/time_tests/CMakeLists.txt +++ b/tests/time_tests/CMakeLists.txt @@ -4,14 +4,17 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) -if (CMAKE_BUILD_TYPE STREQUAL "") - message(STATUS "CMAKE_BUILD_TYPE not defined, 'Release' will be used") - set(CMAKE_BUILD_TYPE "Release") -endif() +set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the build type") -find_package(InferenceEngineDeveloperPackage QUIET) -if (NOT InferenceEngineDeveloperPackage_FOUND) - find_package(InferenceEngine REQUIRED) +project(time_tests) + + +find_package(InferenceEngine) +if (NOT InferenceEngine_FOUND) + set (HAVE_SYS_STAT_H 1) + set (HAVE_INTTYPES_H 1) + set (INTTYPES_FORMAT C99) + find_package(InferenceEngineDeveloperPackage REQUIRED) endif() add_subdirectory(src) diff --git a/tests/time_tests/src/timetests_helper/CMakeLists.txt b/tests/time_tests/src/timetests_helper/CMakeLists.txt index 072805bd42a..0e75039751e 100644 --- a/tests/time_tests/src/timetests_helper/CMakeLists.txt +++ b/tests/time_tests/src/timetests_helper/CMakeLists.txt @@ -8,36 +8,16 @@ file (GLOB SRC *.cpp) add_library(${TARGET_NAME} STATIC ${SRC}) target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_SOURCE_DIR}/include") -find_package(gflags QUIET) -if (gflags_FOUND) - set(GFLAGS_LIBRARIES gflags) # use gflags from developer package -else() - include(ExternalProject) - find_package(Threads) - set(gflags_PREFIX ${CMAKE_BINARY_DIR}/external/gflags-prefix) - set(gflags_INSTALL ${CMAKE_BINARY_DIR}/external/gflags-install) - set(gflags_LIB ${gflags_INSTALL}/lib/libgflags.a) - - ExternalProject_Add( - gflags - PREFIX ${gflags_PREFIX} - GIT_REPOSITORY "https://github.com/gflags/gflags.git" - GIT_TAG "v2.2.2" - UPDATE_COMMAND "" - INSTALL_DIR ${gflags_INSTALL} - CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} - CMAKE_GENERATOR ${CMAKE_GENERATOR} - CMAKE_GENERATOR_PLATFORM ${CMAKE_GENERATOR_PLATFORM} - CMAKE_GENERATOR_TOOLSET ${CMAKE_GENERATOR_TOOLSET} - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${gflags_INSTALL} - EXCLUDE_FROM_ALL TRUE - BUILD_BYPRODUCTS ${gflags_LIB} - LOG_DOWNLOAD 1 - LOG_INSTALL 1 - ) - set(GFLAGS_LIBRARIES ${gflags_LIB} ${CMAKE_THREAD_LIBS_INIT}) - add_dependencies(${TARGET_NAME} gflags) - target_include_directories(${TARGET_NAME} PRIVATE "${gflags_INSTALL}/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}) endif() -target_link_libraries(${TARGET_NAME} ${GFLAGS_LIBRARIES}) +target_link_libraries(${TARGET_NAME} gflags)