From db98f25428e930af81617831686a1c1e091b0ae9 Mon Sep 17 00:00:00 2001 From: Shashwat Agrawal Date: Sat, 11 Jul 2026 15:26:56 +0530 Subject: [PATCH] build(cmake): use nlohmann/json git submodule instead of FetchContent Vendors nlohmann/json at v3.12.0 under backend/external/json so builds no longer need a network download for the dependency. Closes #23. --- .gitmodules | 3 +++ backend/CMakeLists.txt | 7 ++++--- backend/external/json | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) create mode 160000 backend/external/json diff --git a/.gitmodules b/.gitmodules index 39e18fd..44fd2fc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "backend/external/uwebsockets"] path = backend/external/uwebsockets url = https://github.com/uNetworking/uWebSockets.git +[submodule "backend/external/json"] + path = backend/external/json + url = https://github.com/nlohmann/json.git diff --git a/backend/CMakeLists.txt b/backend/CMakeLists.txt index 17b83d1..2fb2469 100644 --- a/backend/CMakeLists.txt +++ b/backend/CMakeLists.txt @@ -34,9 +34,10 @@ FetchContent_Declare( ) FetchContent_MakeAvailable(tec.h) -# https://json.nlohmann.me/integration/cmake/#fetchcontent -FetchContent_Declare(nlohmann_json URL https://github.com/nlohmann/json/releases/download/v3.12.0/json.tar.xz) -FetchContent_MakeAvailable(nlohmann_json) +# nlohmann/json via git submodule (backend/external/json) +set(JSON_BuildTests OFF CACHE INTERNAL "") +set(JSON_Install OFF CACHE INTERNAL "") +add_subdirectory(external/json) find_package(OpenSSL REQUIRED) find_package(ZLIB REQUIRED) diff --git a/backend/external/json b/backend/external/json new file mode 160000 index 0000000..55f9368 --- /dev/null +++ b/backend/external/json @@ -0,0 +1 @@ +Subproject commit 55f93686c01528224f448c19128836e7df245f72