From 1f6330237649f7ef0032c007e23534d9d8cf08d6 Mon Sep 17 00:00:00 2001 From: Tom Tan Date: Wed, 23 Jul 2025 17:41:54 +0000 Subject: [PATCH] [Geneva] error out for missing dpes when building as external component --- exporters/fluentd/CMakeLists.txt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/exporters/fluentd/CMakeLists.txt b/exporters/fluentd/CMakeLists.txt index 646e29a4d..ca0d389c0 100644 --- a/exporters/fluentd/CMakeLists.txt +++ b/exporters/fluentd/CMakeLists.txt @@ -41,12 +41,16 @@ set(nlohmann_json_clone FALSE) if(nlohmann_json_FOUND) message("Using external nlohmann::json") else() - include(cmake/nlohmann-json.cmake) - set(nlohmann_json_clone TRUE) - set(nlohmann_json_SOURCE_DIR - "${CMAKE_SOURCE_DIR}/nlohmann_json/single_include") - include_directories(${nlohmann_json_SOURCE_DIR}) - message("nlohmann_json package was not found. Cloning from github") + if (MAIN_PROJECT) + include(cmake/nlohmann-json.cmake) + set(nlohmann_json_clone TRUE) + set(nlohmann_json_SOURCE_DIR + "${CMAKE_SOURCE_DIR}/nlohmann_json/single_include") + include_directories(${nlohmann_json_SOURCE_DIR}) + message("nlohmann_json package was not found. Cloning from github") + else() + message(FATAL_ERROR "nlohmann_json package was not found which is required for opentelemetry-cpp-fluentd. Please install it") + endif() endif() if(MAIN_PROJECT)