mirror of
https://github.com/nlohmann/json.git
synced 2026-10-03 13:10:33 +00:00
As CMake's generated targets file does, reset _IMPORT_PREFIX to an empty string when it resolves to "/". Reported by @heitbaum in #5587. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
43 lines
1.7 KiB
CMake
43 lines
1.7 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), unless includedir or
|
|
# datadir is outside the prefix.
|
|
|
|
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)
|
|
# As in CMake's generated file: avoid "//include" for an installation to "/".
|
|
if(_IMPORT_PREFIX STREQUAL "/")
|
|
set(_IMPORT_PREFIX "")
|
|
endif()
|
|
|
|
add_library(@PROJECT_NAME@::@NLOHMANN_JSON_TARGET_NAME@ INTERFACE IMPORTED)
|
|
set_target_properties(@PROJECT_NAME@::@NLOHMANN_JSON_TARGET_NAME@ PROPERTIES
|
|
INTERFACE_INCLUDE_DIRECTORIES "@NLOHMANN_JSON_INCLUDE_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)
|