Skip to content

Commit

Permalink
Allow overriding the CMake target name
Browse files Browse the repository at this point in the history
  • Loading branch information
iboB committed Nov 4, 2024
1 parent 6325839 commit 7ae3ff6
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 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 7ae3ff6

Please sign in to comment.