Skip to content

Commit

Permalink
Protect target JsonCpp::JsonCpp against multi-include (#1435)
Browse files Browse the repository at this point in the history
* Protect target JsonCpp::JsonCpp against multi-include

Fixes #1356

* Simplify (@BillyDonahue)

---------

Co-authored-by: Jordan Bayles <[email protected]>
  • Loading branch information
rjoomen and baylesj authored Sep 10, 2024
1 parent 48d2e10 commit fa0dff1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions jsoncpp-namespaced-targets.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
if (TARGET jsoncpp_static)
add_library(JsonCpp::JsonCpp INTERFACE IMPORTED)
set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_static")
elseif (TARGET jsoncpp_lib)
add_library(JsonCpp::JsonCpp INTERFACE IMPORTED)
set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_lib")
endif ()
if (NOT TARGET JsonCpp::JsonCpp)
if (TARGET jsoncpp_static)
add_library(JsonCpp::JsonCpp INTERFACE IMPORTED)
set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_static")
elseif (TARGET jsoncpp_lib)
add_library(JsonCpp::JsonCpp INTERFACE IMPORTED)
set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_lib")
endif ()
endif ()

0 comments on commit fa0dff1

Please sign in to comment.