Skip to content

Commit

Permalink
Allow overriding the CMake target name (nlohmann#4483)
Browse files Browse the repository at this point in the history
  • Loading branch information
iboB authored and slowriot committed Jan 10, 2025
1 parent 81ed8d1 commit 7566ba8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 7566ba8

Please sign in to comment.