1
0
mirror of https://github.com/nlohmann/json synced 2024-11-08 21:50:07 +00:00

Allow overriding the CMake target name

This commit is contained in:
Borislav Stanimirov 2024-11-04 13:23:21 +02:00
parent 6325839776
commit 0da0d2e739
No known key found for this signature in database
GPG Key ID: 85AD7C1E5581FC30

View File

@ -57,7 +57,11 @@ endif ()
##
include(GNUInstallDirs)
set(NLOHMANN_JSON_TARGET_NAME ${PROJECT_NAME})
if (NOT DEFINED NLOHMANN_JSON_TARGET_NAME)
# Allow overriding the target name when using FetchContent / add_subdirectory.
set(NLOHMANN_JSON_TARGET_NAME ${PROJECT_NAME})
endif()
set(NLOHMANN_JSON_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/cmake/${PROJECT_NAME}" CACHE INTERNAL "")
set(NLOHMANN_JSON_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
set(NLOHMANN_JSON_TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")