Allow overriding the CMake target name (#4483)

This commit is contained in:
Borislav Stanimirov 2024-11-08 22:42:36 +02:00 committed by GitHub
parent aff5a31d35
commit 18ff442e63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -57,7 +57,11 @@ endif ()
##
include(GNUInstallDirs)
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")