summaryrefslogtreecommitdiff
path: root/json4cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'json4cpp/src')
-rw-r--r--json4cpp/src/modules/CMakeLists.txt27
-rw-r--r--json4cpp/src/modules/json.cppm32
2 files changed, 59 insertions, 0 deletions
diff --git a/json4cpp/src/modules/CMakeLists.txt b/json4cpp/src/modules/CMakeLists.txt
new file mode 100644
index 0000000000..f8b79d0ef6
--- /dev/null
+++ b/json4cpp/src/modules/CMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 3.28)
+
+add_library(nlohmann_json_modules)
+
+set(NLOHMANN_JSON_MODULES
+ json.cppm
+)
+
+if(NOT COMMAND configure_cpp_module_target)
+ function(configure_cpp_module_target target)
+ target_sources(${target} PUBLIC FILE_SET CXX_MODULES FILES ${NLOHMANN_JSON_MODULES})
+ endfunction()
+endif()
+
+configure_cpp_module_target(nlohmann_json_modules)
+
+target_link_libraries(nlohmann_json_modules
+ PUBLIC
+ nlohmann_json::nlohmann_json
+)
+
+target_include_directories(nlohmann_json_modules
+ PRIVATE
+ ${PROJECT_SOURCE_DIR}/include
+)
+
+target_compile_features(nlohmann_json_modules PUBLIC cxx_std_20)
diff --git a/json4cpp/src/modules/json.cppm b/json4cpp/src/modules/json.cppm
new file mode 100644
index 0000000000..623d8cb81f
--- /dev/null
+++ b/json4cpp/src/modules/json.cppm
@@ -0,0 +1,32 @@
+module;
+
+#include <nlohmann/json.hpp>
+
+export module nlohmann.json;
+
+export namespace nlohmann {
+ using ::nlohmann::adl_serializer;
+ using ::nlohmann::basic_json;
+ using ::nlohmann::json;
+ using ::nlohmann::json_pointer;
+ using ::nlohmann::ordered_json;
+ using ::nlohmann::ordered_map;
+} // namespace nlohmann
+
+NLOHMANN_JSON_NAMESPACE_BEGIN
+
+namespace detail
+{
+ export using NLOHMANN_JSON_NAMESPACE::detail::json_sax_dom_callback_parser;
+ export using NLOHMANN_JSON_NAMESPACE::detail::unknown_size;
+} // namespace detail
+
+export using NLOHMANN_JSON_NAMESPACE::adl_serializer;
+export using NLOHMANN_JSON_NAMESPACE::basic_json;
+export using NLOHMANN_JSON_NAMESPACE::json;
+export using NLOHMANN_JSON_NAMESPACE::json_pointer;
+export using NLOHMANN_JSON_NAMESPACE::ordered_json;
+export using NLOHMANN_JSON_NAMESPACE::ordered_map;
+export using NLOHMANN_JSON_NAMESPACE::to_string;
+
+NLOHMANN_JSON_NAMESPACE_END