Protect target JsonCpp::JsonCpp against multi-include (#1435)

* Protect target JsonCpp::JsonCpp against multi-include

Fixes #1356

* Simplify (@BillyDonahue)

---------

Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
This commit is contained in:
Roelof Oomen 2024-09-10 05:02:24 +02:00 committed by GitHub
parent 48d2e106a7
commit fa0dff18fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,7 +1,9 @@
if (TARGET jsoncpp_static)
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)
elseif (TARGET jsoncpp_lib)
add_library(JsonCpp::JsonCpp INTERFACE IMPORTED)
set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_lib")
endif ()
endif ()