mirror of
https://github.com/nlohmann/json.git
synced 2024-08-21 04:22:28 +02:00
* Add versioned inline namespace Add a versioned inline namespace to prevent ABI issues when linking code using multiple library versions. * Add namespace macros * Encode ABI information in inline namespace Add _diag suffix to inline namespace if JSON_DIAGNOSTICS is enabled, and _ldvcmp suffix if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON is enabled. * Move ABI-affecting macros into abi_macros.hpp * Move std_fs namespace definition into std_fs.hpp * Remove std_fs namespace from unit test * Format more files in tests directory * Add unit tests * Update documentation * Fix GDB pretty printer * fixup! Add namespace macros * Derive ABI prefix from NLOHMANN_JSON_VERSION_*
30 lines
1.1 KiB
CMake
30 lines
1.1 KiB
CMake
# common build settings
|
|
add_library(abi_compat_common INTERFACE)
|
|
target_compile_definitions(abi_compat_common INTERFACE
|
|
DOCTEST_CONFIG_SUPER_FAST_ASSERTS
|
|
JSON_TEST_KEEP_MACROS)
|
|
target_compile_features(abi_compat_common INTERFACE cxx_std_11)
|
|
target_compile_options(abi_compat_common INTERFACE
|
|
$<$<CXX_COMPILER_ID:MSVC>:/EHsc;$<$<CONFIG:Release>:/Od>>
|
|
# MSVC: Force to always compile with W4
|
|
$<$<CXX_COMPILER_ID:MSVC>:/W4>
|
|
|
|
# https://github.com/nlohmann/json/pull/3229
|
|
$<$<CXX_COMPILER_ID:Intel>:-diag-disable=2196>
|
|
|
|
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-deprecated;-Wno-float-equal>
|
|
$<$<CXX_COMPILER_ID:GNU>:-Wno-deprecated-declarations>
|
|
$<$<CXX_COMPILER_ID:Intel>:-diag-disable=1786>)
|
|
target_include_directories(abi_compat_common SYSTEM INTERFACE
|
|
../thirdparty/doctest
|
|
include)
|
|
target_link_libraries(abi_compat_common INTERFACE ${NLOHMANN_JSON_TARGET_NAME})
|
|
|
|
# shared main()
|
|
add_library(abi_compat_main STATIC main.cpp)
|
|
target_link_libraries(abi_compat_main PUBLIC abi_compat_common)
|
|
|
|
# add individual tests
|
|
add_subdirectory(diag)
|
|
add_subdirectory(inline_ns)
|