From 30d5107b8d56c458357746892942279ca0475fbc Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Wed, 30 Sep 2026 17:59:47 +0200 Subject: [PATCH] Add json_fwd.hpp to the Bazel singleheader-json target The generator for BUILD.bazel only listed single_include/nlohmann/json.hpp in the singleheader-json cc_library's hdrs. Bazel's sandboxing only exposes declared headers, so a consumer of :singleheader-json that includes failed with "file not found" (verified with Bazel 9.2.0). Meson and include.zip already ship json_fwd.hpp; the Bazel target was missing it. Add single_include/nlohmann/json_fwd.hpp to the hdrs list and regenerate BUILD.bazel. Verified that `bazel build //:json //:singleheader-json` succeeds and that a consumer cc_binary depending on :singleheader-json can now include . Overlaps #5621, which adds json_view.hpp to the same hdrs list in gen_bazel_build_file.cmake; that PR will need a rebase. #5716 item 2 Signed-off-by: Niels Lohmann --- BUILD.bazel | 1 + cmake/scripts/gen_bazel_build_file.cmake | 1 + 2 files changed, 2 insertions(+) diff --git a/BUILD.bazel b/BUILD.bazel index db59095cd..988964e66 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -77,6 +77,7 @@ cc_library( name = "singleheader-json", hdrs = [ "single_include/nlohmann/json.hpp", + "single_include/nlohmann/json_fwd.hpp", ], includes = ["single_include"], visibility = ["//visibility:public"], diff --git a/cmake/scripts/gen_bazel_build_file.cmake b/cmake/scripts/gen_bazel_build_file.cmake index a781a2e3f..ca5069cb0 100644 --- a/cmake/scripts/gen_bazel_build_file.cmake +++ b/cmake/scripts/gen_bazel_build_file.cmake @@ -48,6 +48,7 @@ cc_library( name = "singleheader-json", hdrs = [ "single_include/nlohmann/json.hpp", + "single_include/nlohmann/json_fwd.hpp", ], includes = ["single_include"], visibility = ["//visibility:public"],