From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- .../cmake/Findnlohmann_json.cmake | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/jaegertracing/jaeger-client-cpp/cmake/Findnlohmann_json.cmake (limited to 'src/jaegertracing/jaeger-client-cpp/cmake/Findnlohmann_json.cmake') diff --git a/src/jaegertracing/jaeger-client-cpp/cmake/Findnlohmann_json.cmake b/src/jaegertracing/jaeger-client-cpp/cmake/Findnlohmann_json.cmake new file mode 100644 index 000000000..c5fc8b048 --- /dev/null +++ b/src/jaegertracing/jaeger-client-cpp/cmake/Findnlohmann_json.cmake @@ -0,0 +1,55 @@ +# - Try to find nlohmann_json +# +# The following variables are optionally searched for defaults +# nlohmann_json_ROOT_DIR: Base directory where all GLOG components are found +# +# The following are set after configuration is done: +# nlohmann_json_FOUND +# nlohmann_json_INCLUDE_DIRS +# nlohmann_json_LIBRARIES + +include(FindPackageHandleStandardArgs) + +# only look in default directories +set(nlohmann_json_INCLUDE_NAME "nlohmann/json.hpp") + +find_path(nlohmann_json_INCLUDE_DIR + NAMES + nlohmann/json.hpp + PATHS /usr/local/include + /usr/include) + +if (NOT nlohmann_json_INCLUDE_DIR) + set(nlohmann_json_INCLUDE_NAME "json.hpp") + find_path( + nlohmann_json_INCLUDE_DIR + NAMES "${nlohmann_json_INCLUDE_NAME}" + ) +endif() + + +# Version detection. Unfortunately the header doesn't expose a proper version +# define. +if (nlohmann_json_INCLUDE_DIR AND nlohmann_json_INCLUDE_NAME) + file(READ "${nlohmann_json_INCLUDE_DIR}/${nlohmann_json_INCLUDE_NAME}" NL_HDR_TXT LIMIT 1000) + if (NL_HDR_TXT MATCHES "version ([0-9]+\.[0-9]+\.[0-9]+)") + set(nlohmann_json_VERSION "${CMAKE_MATCH_1}") + endif() +endif() + +set(nlohmann_json_VERSION "${nlohmann_json_VERSION}" CACHE STRING "nlohmann header version") + +# handle the QUIETLY and REQUIRED arguments and set nlohmann_json_FOUND to TRUE +# if all listed variables are TRUE, hide their existence from configuration view +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + nlohmann_json + REQUIRED_VARS nlohmann_json_INCLUDE_DIR nlohmann_json_INCLUDE_NAME + VERSION_VAR nlohmann_json_VERSION) + +if(nlohmann_json_FOUND AND NOT (TARGET nlohmann_json)) + add_library(nlohmann_json SHARED IMPORTED) + set_target_properties(nlohmann_json PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${nlohmann_json_INCLUDE_DIR}" + ) +endif() -- cgit v1.2.3