Skip to content

Commit 52597cf

Browse files
dmehalasjanel
andauthored
deps(nlohmann-json): avoid FetchContent if found via find_package (#231)
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: Stephane JANEL <[email protected]>
1 parent 1a31e1e commit 52597cf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cmake/deps/json.cmake

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ include(FetchContent)
33
set(JSON_BuildTests OFF)
44
set(JSON_Install OFF)
55

6-
FetchContent_Declare(json
7-
URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz
6+
FetchContent_Declare(nlohmann_json
7+
URL https://github.com/nlohmann/json/archive/refs/tags/v3.12.0.tar.gz
8+
URL_HASH SHA256=4b92eb0c06d10683f7447ce9406cb97cd4b453be18d7279320f7b2f025c10187
9+
FIND_PACKAGE_ARGS NAMES nlohmann_json
810
)
911

10-
FetchContent_MakeAvailable(json)
12+
FetchContent_MakeAvailable(nlohmann_json)

0 commit comments

Comments
 (0)