From e5917bb0a18423b43e436fdf3ded5aaa8eef2cce Mon Sep 17 00:00:00 2001 From: Billy Robert O'Neal III Date: Thu, 9 Apr 2026 20:11:09 -0700 Subject: [PATCH 1/2] Add patch to not vendor nlohmann_json when USE_SYSTEM_DEPS is on written by gpt-5.3-codex. --- icey.cmake | 1 + src/json/CMakeLists.txt | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/icey.cmake b/icey.cmake index f99c4f7f..b977b6ae 100644 --- a/icey.cmake +++ b/icey.cmake @@ -210,6 +210,7 @@ else() pkg_check_modules(LIBUV QUIET IMPORTED_TARGET GLOBAL libuv) endif() find_package(llhttp CONFIG QUIET) + find_package(nlohmann_json CONFIG REQUIRED) find_package(ZLIB REQUIRED) if(NOT TARGET llhttp_static AND NOT TARGET llhttp::llhttp_static diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index 8983ef5c..976899e3 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -1,6 +1,12 @@ -icy_add_module(json - DEPENDS base - PRETTY_NAME JSON -) -# nlohmann/json.hpp is vendored in include/nlohmann/ (MIT licensed, single-header) -# so no external dependency is needed - icy_add_module already adds our include dir. +if(USE_SYSTEM_DEPS) + icy_add_module(json + DEPENDS base + PACKAGES nlohmann_json::nlohmann_json + PRETTY_NAME JSON + ) +else() + icy_add_module(json + DEPENDS base + PRETTY_NAME JSON + ) +endif() From 33e75e458f0fca6f57d54a10999cd8614a13ff69 Mon Sep 17 00:00:00 2001 From: Kam Date: Fri, 10 Apr 2026 21:49:31 +1000 Subject: [PATCH 2/2] fix(cmake): export nlohmann_json dependency --- cmake/icey_build_config.cmake.in | 3 +++ cmake/icey_config.cmake.in | 3 +++ icey.cmake | 4 +++- src/json/CMakeLists.txt | 8 ++++++++ src/json/{include => vendor}/nlohmann/json.hpp | 0 5 files changed, 17 insertions(+), 1 deletion(-) rename src/json/{include => vendor}/nlohmann/json.hpp (100%) diff --git a/cmake/icey_build_config.cmake.in b/cmake/icey_build_config.cmake.in index aae2c22c..ccf13c38 100644 --- a/cmake/icey_build_config.cmake.in +++ b/cmake/icey_build_config.cmake.in @@ -44,6 +44,9 @@ if(_icey_have_libdatachannel AND DEFINED icey_FIND_COMPONENTS AND "webrtc" IN_LI endif() if(@USE_SYSTEM_DEPS@) + if("json" IN_LIST _icey_supported_components) + find_dependency(nlohmann_json CONFIG) + endif() find_package(libuv CONFIG QUIET) if(NOT TARGET libuv::uv_a AND NOT TARGET libuv::uv AND NOT TARGET libuv::libuv AND PkgConfig_FOUND) pkg_check_modules(LIBUV QUIET IMPORTED_TARGET GLOBAL libuv) diff --git a/cmake/icey_config.cmake.in b/cmake/icey_config.cmake.in index 447929b9..0e14d025 100644 --- a/cmake/icey_config.cmake.in +++ b/cmake/icey_config.cmake.in @@ -59,6 +59,9 @@ if(NOT TARGET llhttp_static) endif() if(@USE_SYSTEM_DEPS@) + if("json" IN_LIST _icey_supported_components) + find_dependency(nlohmann_json CONFIG) + endif() find_dependency(ZLIB) if("archo" IN_LIST _icey_supported_components OR "pacm" IN_LIST _icey_supported_components) find_dependency(unofficial-minizip CONFIG QUIET) diff --git a/icey.cmake b/icey.cmake index b977b6ae..0d766619 100644 --- a/icey.cmake +++ b/icey.cmake @@ -210,7 +210,9 @@ else() pkg_check_modules(LIBUV QUIET IMPORTED_TARGET GLOBAL libuv) endif() find_package(llhttp CONFIG QUIET) - find_package(nlohmann_json CONFIG REQUIRED) + if(BUILD_MODULES AND (NOT DEFINED BUILD_MODULE_json OR BUILD_MODULE_json)) + find_package(nlohmann_json CONFIG REQUIRED) + endif() find_package(ZLIB REQUIRED) if(NOT TARGET llhttp_static AND NOT TARGET llhttp::llhttp_static diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index 976899e3..905c5008 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -9,4 +9,12 @@ else() DEPENDS base PRETTY_NAME JSON ) + target_include_directories(json + PUBLIC + $ + ) + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/vendor/" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + COMPONENT dev + ) endif() diff --git a/src/json/include/nlohmann/json.hpp b/src/json/vendor/nlohmann/json.hpp similarity index 100% rename from src/json/include/nlohmann/json.hpp rename to src/json/vendor/nlohmann/json.hpp