mirror of
https://github.com/nlohmann/json.git
synced 2026-10-03 05:00:30 +00:00
Complete the Meson options and match CMake's compile definitions
Finish the Meson changes from #4452: - Offer all eight options that change the CMake target, named like the CMake options without the JSON_ prefix. MultipleHeaders defaults to false so that existing Meson users keep the single header. - Add a compile definition only for an option that differs from its default, exactly as target_compile_definitions does. Before, the GlobalUDLs and ImplicitConversions definitions were inverted and were also added in the default configuration. - Keep the nlohmann_json_multiple_headers dependency that earlier versions of meson.build provided. - Put the definitions into the pkg-config file and the Meson-generated nlohmann_jsonTargets.cmake, and install the pkg-config file into <datadir>/pkgconfig like CMake does. - Ship meson_options.txt in include.zip, since meson.build now reads options and the zip is documented as a Meson subproject. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -2,8 +2,9 @@
|
||||
#
|
||||
# CMake installations generate this file with install(EXPORT ...). Meson cannot
|
||||
# do that, but as the library is header-only, the target only needs an include
|
||||
# directory and the C++ standard. Paths are computed relative to this file so
|
||||
# that the installation can be relocated (e.g., into a sysroot).
|
||||
# directory, the C++ standard, and the compile definitions of the options that
|
||||
# differ from their defaults. Paths are computed relative to this file so that
|
||||
# the installation can be relocated (e.g., into a sysroot).
|
||||
|
||||
if(TARGET @PROJECT_NAME@::@NLOHMANN_JSON_TARGET_NAME@)
|
||||
return()
|
||||
@@ -25,4 +26,12 @@ else()
|
||||
)
|
||||
endif()
|
||||
|
||||
set(_NLOHMANN_JSON_COMPILE_DEFINITIONS "@NLOHMANN_JSON_COMPILE_DEFINITIONS@")
|
||||
if(_NLOHMANN_JSON_COMPILE_DEFINITIONS)
|
||||
set_target_properties(@PROJECT_NAME@::@NLOHMANN_JSON_TARGET_NAME@ PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS "${_NLOHMANN_JSON_COMPILE_DEFINITIONS}"
|
||||
)
|
||||
endif()
|
||||
|
||||
unset(_NLOHMANN_JSON_COMPILE_DEFINITIONS)
|
||||
unset(_IMPORT_PREFIX)
|
||||
|
||||
Reference in New Issue
Block a user