mirror of
https://github.com/nlohmann/json.git
synced 2025-07-31 10:24:23 +03:00
Make library work with C++20 modules (#4764)
* ✅ add test for C++20 modules Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warning Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Add missing header (#4763) * 🐛 add missing header Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warning Signed-off-by: Niels Lohmann <mail@nlohmann.me> * 🚨 fix warning Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
12
tests/module_cpp20/CMakeLists.txt
Normal file
12
tests/module_cpp20/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
|
||||
project(json_test CXX)
|
||||
|
||||
add_executable(json_test)
|
||||
|
||||
target_sources(json_test
|
||||
PRIVATE main.cpp
|
||||
PUBLIC FILE_SET cxx_modules TYPE CXX_MODULES FILES json.cpp)
|
||||
|
||||
target_compile_features(json_test PUBLIC cxx_std_20)
|
||||
target_include_directories(json_test PRIVATE ../../include)
|
17
tests/module_cpp20/json.cpp
Normal file
17
tests/module_cpp20/json.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
module;
|
||||
#include <nlohmann/json.hpp>
|
||||
export module json;
|
||||
|
||||
export namespace nlohmann
|
||||
{
|
||||
using ::nlohmann::adl_serializer;
|
||||
|
||||
using ::nlohmann::basic_json;
|
||||
using ::nlohmann::json_pointer;
|
||||
|
||||
using ::nlohmann::json;
|
||||
using ::nlohmann::ordered_json;
|
||||
using ::nlohmann::ordered_map;
|
||||
|
||||
using ::nlohmann::json_pointer;
|
||||
} // namespace nlohmann
|
6
tests/module_cpp20/main.cpp
Normal file
6
tests/module_cpp20/main.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
import json;
|
||||
|
||||
int main()
|
||||
{
|
||||
nlohmann::json j;
|
||||
}
|
Reference in New Issue
Block a user