From 8e5a7ed24e99e462efca993e7a16e5ab32ee38e0 Mon Sep 17 00:00:00 2001 From: Augustin Trancart Date: Thu, 1 Aug 2024 11:50:33 +0200 Subject: [PATCH] improve json lib discovery for cmake --- cmake/CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 382e7396b4..60294c2256 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -221,10 +221,11 @@ endif() if(GLTF_SUPPORT OR CITYJSON_SUPPORT) UNIFY_ENVVARS_AND_CACHE(JSON_INCLUDE_DIR) - find_file(json_hpp "json.hpp" ${JSON_INCLUDE_DIR}/nlohmann) + find_path(json_header_path "json.hpp" ${JSON_INCLUDE_DIR} PATH_SUFFIXES "nlohmann") + set(JSON_INCLUDE_DIR ${json_header_path}) - if(json_hpp) - message(STATUS "JSON for Modern C++ header file found") + if(json_header_path) + message(STATUS "JSON for Modern C++ header file found in ${JSON_INCLUDE_DIR}") else() message(FATAL_ERROR "Unable to find JSON for Modern C++ header file, aborting") endif()