mirror of
https://github.com/nlohmann/json.git
synced 2025-06-11 05:54:06 +08:00
Requested changes
Signed-off-by: Toyosatomimi no Miko <110693261+mikomikotaishi@users.noreply.github.com>
This commit is contained in:
parent
a56e9d2700
commit
e4553073cc
@ -27,10 +27,10 @@ option(NLOHMANN_JSON_BUILD_MODULES "Build C++ modules support" OFF)
|
||||
|
||||
if(NLOHMANN_JSON_BUILD_MODULES)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28)
|
||||
message(STATUS "Building nlohmann-json C++ modules (CMake ${CMAKE_VERSION} supports modules)")
|
||||
add_subdirectory(modules)
|
||||
message(STATUS "Building nlohmann.json C++ module")
|
||||
add_subdirectory(src/modules)
|
||||
else()
|
||||
message(WARNING "Skipping nlohmann-json C++ modules (requires CMake 3.28+, found ${CMAKE_VERSION})")
|
||||
message(WARNING "Skipping nlohmann.json C++ module (requires CMake 3.28+, found ${CMAKE_VERSION})")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
# Modules
|
||||
|
||||
This library supports C++ modules, introduced in C++20. The library can be imported by writing `import nlohmann.json;` instead of `#include <nlohmann/json.hpp>`.
|
||||
This library has experimental support for C++ modules, introduced in C++20. The library can be imported by writing `import nlohmann.json;` instead of `#include <nlohmann/json.hpp>`.
|
||||
|
||||
Please be aware that the module is experimental and a full test is outstanding, and the exported symbols are subject to change.
|
||||
|
||||
## Requirements
|
||||
The `nlohmann.json` module requires that the build system is configured to build and resolve modules when imported. Obviously, as modules were introduced in C++20, this feature can only be used in C++20 and subsequent versions.
|
||||
|
@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.28)
|
||||
|
||||
project(json_test CXX)
|
||||
|
||||
set(nlohmann_json_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../build/modules)
|
||||
set(nlohmann_json_DIR ${CMAKE_BINARY_DIR}/modules)
|
||||
|
||||
set(NLOHMANN_JSON_BUILD_MODULES ON CACHE BOOL "Enable nlohmann-json module support")
|
||||
set(NLOHMANN_JSON_BUILD_MODULES ON CACHE BOOL "Enable nlohmann.json module support")
|
||||
|
||||
add_subdirectory(../.. build)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/../.. ${CMAKE_BINARY_DIR}/tests)
|
||||
|
||||
add_executable(json_test main.cpp)
|
||||
target_link_libraries(json_test
|
||||
|
Loading…
Reference in New Issue
Block a user