Skip to content

Commit 37dffd3

Browse files
committed
fix CMake and nlohmann_json
1 parent 5dc1ed9 commit 37dffd3

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

bindings/cpp/CMakeLists.txt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -255,14 +255,17 @@ if (FLUSS_ENABLE_TESTING)
255255
)
256256
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
257257

258-
set(JSON_BuildTests OFF CACHE INTERNAL "")
259-
FetchContent_Declare(
260-
nlohmann_json
261-
URL https://github.com/nlohmann/json/archive/refs/tags/v${FLUSS_NLOHMANN_JSON_VERSION}.tar.gz
262-
URL_HASH SHA256=0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406
263-
)
264-
265-
FetchContent_MakeAvailable(googletest nlohmann_json)
258+
FetchContent_MakeAvailable(googletest)
259+
260+
if (NOT TARGET nlohmann_json::nlohmann_json)
261+
set(JSON_BuildTests OFF CACHE INTERNAL "")
262+
FetchContent_Declare(
263+
nlohmann_json
264+
URL https://github.com/nlohmann/json/archive/refs/tags/v${FLUSS_NLOHMANN_JSON_VERSION}.tar.gz
265+
URL_HASH SHA256=0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406
266+
)
267+
FetchContent_MakeAvailable(nlohmann_json)
268+
endif()
266269

267270
enable_testing()
268271
include(GoogleTest)

0 commit comments

Comments
 (0)