From 7fcce21e5359cc5664b39e754fc18839a65b8cf0 Mon Sep 17 00:00:00 2001 From: Stephane JANEL Date: Tue, 5 Aug 2025 10:59:50 +0200 Subject: [PATCH] deps(nlohmann-json): avoid FetchContent if found via find_package Add `FIND_PACKAGE_ARGS` will help `FetchContent_*` to satisfy the dependency with `find_package()`. If that dependency is not found, then it is built from source. Co-authored-by: Damien Mehala --- cmake/deps/json.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmake/deps/json.cmake b/cmake/deps/json.cmake index dc763e6b..1007d48f 100644 --- a/cmake/deps/json.cmake +++ b/cmake/deps/json.cmake @@ -3,8 +3,10 @@ include(FetchContent) set(JSON_BuildTests OFF) set(JSON_Install OFF) -FetchContent_Declare(json - URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz +FetchContent_Declare(nlohmann_json + URL https://github.com/nlohmann/json/archive/refs/tags/v3.12.0.tar.gz + URL_HASH SHA256=4b92eb0c06d10683f7447ce9406cb97cd4b453be18d7279320f7b2f025c10187 + FIND_PACKAGE_ARGS NAMES nlohmann_json ) -FetchContent_MakeAvailable(json) +FetchContent_MakeAvailable(nlohmann_json) \ No newline at end of file