Skip to content

Commit

Permalink
Fix double declared nlomann_json target when used in external project…
Browse files Browse the repository at this point in the history
…s through add_subdirectory
  • Loading branch information
IESE-T3 committed Mar 8, 2023
1 parent 369a90e commit ad056d5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/nlohmann_json/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

project(nlohmann_json VERSION 3.11.2)

if(NOT TARGET nlohmann_json)

add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include")

add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

endif()

0 comments on commit ad056d5

Please sign in to comment.