diff --git a/samples/cpp/CMakeLists.txt b/samples/cpp/CMakeLists.txt index 4c9ebc56f51..47f629506eb 100644 --- a/samples/cpp/CMakeLists.txt +++ b/samples/cpp/CMakeLists.txt @@ -140,8 +140,13 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/cnpy") add_subdirectory(thirdparty/cnpy EXCLUDE_FROM_ALL) endif() -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/json") - add_subdirectory(thirdparty/json EXCLUDE_FROM_ALL) +if(NOT TARGET nlohmann_json::nlohmann_json) + find_package(nlohmann_json QUIET) + if(nlohmann_json_FOUND) + message(STATUS "nlohmann_json (${nlohmann_json_VERSION}) is found at ${nlohmann_json_DIR}") + elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/nlohmann_json") + add_subdirectory(thirdparty/json EXCLUDE_FROM_ALL) + endif() endif() if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/utils") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 037a72b150e..fdff11134ae 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,7 +14,9 @@ add_subdirectory(common) add_subdirectory(core) add_subdirectory(frontends) # TODO: remove ngraph/ngraph.hpp usage -add_subdirectory(core/tests) +if(ENABLE_TESTS) + add_subdirectory(core/tests) +endif() add_subdirectory(bindings) if(CMAKE_COMPILER_IS_GNUCXX) diff --git a/src/frontends/CMakeLists.txt b/src/frontends/CMakeLists.txt index d0509d1b658..491b2e9bf57 100644 --- a/src/frontends/CMakeLists.txt +++ b/src/frontends/CMakeLists.txt @@ -7,7 +7,10 @@ if(ENABLE_LTO) endif() add_subdirectory(common) -add_subdirectory(tests) + +if(ENABLE_TESTS) + add_subdirectory(tests) +endif() if(ENABLE_OV_ONNX_FRONTEND) add_subdirectory(onnx) diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index dbe374f5b26..3dd79eb9d06 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -157,18 +157,13 @@ endif() # nlohmann json # -# find_package(nlohmann_json QUIET) -# if(nlohmann_json_FOUND) -# nlohmann_json::nlohmann_json -# else() - add_subdirectory(json) +add_subdirectory(json) - openvino_developer_export_targets(COMPONENT openvino_common - TARGETS nlohmann_json nlohmann_json_schema_validator) +openvino_developer_export_targets(COMPONENT openvino_common + TARGETS nlohmann_json nlohmann_json_schema_validator) - ov_install_static_lib(nlohmann_json openvino_common) - ov_install_static_lib(nlohmann_json_schema_validator openvino_common) -# endif() +ov_install_static_lib(nlohmann_json openvino_common) +ov_install_static_lib(nlohmann_json_schema_validator openvino_common) # # Install