mirror of
https://github.com/nlohmann/json.git
synced 2026-10-03 13:10:33 +00:00
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>
38 lines
1.5 KiB
CMake
38 lines
1.5 KiB
CMake
# Imported target for installations made with Meson (see meson.build).
|
|
#
|
|
# 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, 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()
|
|
endif()
|
|
|
|
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_DIR}/@NLOHMANN_JSON_CONFIG_TO_PREFIX@" ABSOLUTE)
|
|
|
|
add_library(@PROJECT_NAME@::@NLOHMANN_JSON_TARGET_NAME@ INTERFACE IMPORTED)
|
|
set_target_properties(@PROJECT_NAME@::@NLOHMANN_JSON_TARGET_NAME@ PROPERTIES
|
|
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/@NLOHMANN_JSON_INCLUDE_INSTALL_DIR@"
|
|
)
|
|
if(CMAKE_VERSION VERSION_LESS 3.8)
|
|
set_target_properties(@PROJECT_NAME@::@NLOHMANN_JSON_TARGET_NAME@ PROPERTIES
|
|
INTERFACE_COMPILE_FEATURES cxx_range_for
|
|
)
|
|
else()
|
|
set_target_properties(@PROJECT_NAME@::@NLOHMANN_JSON_TARGET_NAME@ PROPERTIES
|
|
INTERFACE_COMPILE_FEATURES cxx_std_11
|
|
)
|
|
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)
|