Only expose include/nlohmann/json.hpp as public header

All other headers are not meant to be included by a client of this
library and should be declared in `srcs`.
This commit is contained in:
Thi Doãn 2023-03-15 13:17:19 +09:00
parent 546370c9e7
commit 7cb526e4da
2 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,6 @@
cc_library(
name = "json",
hdrs = [
srcs = [
"include/nlohmann/adl_serializer.hpp",
"include/nlohmann/byte_container_with_subtype.hpp",
"include/nlohmann/detail/abi_macros.hpp",
@ -41,12 +41,12 @@ cc_library(
"include/nlohmann/detail/string_concat.hpp",
"include/nlohmann/detail/string_escape.hpp",
"include/nlohmann/detail/value_t.hpp",
"include/nlohmann/json.hpp",
"include/nlohmann/json_fwd.hpp",
"include/nlohmann/ordered_map.hpp",
"include/nlohmann/thirdparty/hedley/hedley.hpp",
"include/nlohmann/thirdparty/hedley/hedley_undef.hpp",
],
hdrs = ["include/nlohmann/json.hpp"],
includes = ["include"],
visibility = ["//visibility:public"],
alwayslink = True,

View File

@ -4,11 +4,12 @@ set(PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}/../..")
set(BUILD_FILE "${PROJECT_ROOT}/BUILD.bazel")
file(GLOB_RECURSE HEADERS LIST_DIRECTORIES false RELATIVE "${PROJECT_ROOT}" "include/*.hpp")
list(REMOVE_ITEM HEADERS "include/nlohmann/json.hpp")
file(WRITE "${BUILD_FILE}" [=[
cc_library(
name = "json",
hdrs = [
srcs = [
]=])
foreach(header ${HEADERS})
@ -17,6 +18,7 @@ endforeach()
file(APPEND "${BUILD_FILE}" [=[
],
hdrs = ["include/nlohmann/json.hpp"],
includes = ["include"],
visibility = ["//visibility:public"],
alwayslink = True,