-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build starts to fail with 1.9.5 due to JsonCpp::JsonCpp target not protected against multi-include #1356
Comments
See open-source-parsers/jsoncpp#1356 Signed-off-by: Frank Lichtenheld <[email protected]>
See #1374 |
This is happening because the if (TARGET jsoncpp_static AND NOT TARGET JsonCpp::JsonCpp)
add_library(JsonCpp::JsonCpp INTERFACE IMPORTED)
set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_static")
elseif (TARGET jsoncpp_lib AND NOT TARGET JsonCpp::JsonCpp)
add_library(JsonCpp::JsonCpp INTERFACE IMPORTED)
set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_lib")
endif () |
What's left to resolve this issue? Seems like the original issue has been resolved and there may be some package resolution follow up work? |
I see no indication that the original issue has been resolved. All the references to merged PRs and commits here are from other projects working around the problem. Merging #1435 would fix it. |
For the record, #1435 solves the problem for me 👍. |
Describe the bug
Our build suddenly started failing after upgrade to jsoncpp 1.9.5 with the following error:
To Reproduce
Have nested CMakeLists which at different places call find_package(jsoncpp)
Expected behavior
With 1.9.4 the build succeeds. All previous targets in jsoncpp-targets.cmake are protected against multiple definitions with something equivalent to "if (TARGET ) return() endif()". But the new target in jsoncpp-namespaced-targets.cmake is not similarly protected.
Potential solutions
Just adding
to jsoncpp-namespaced-targets.cmake seems to prevent the issue. If you want I can open a PR to that effect. #1306 might also fix it, I haven't tested that, yet.
The text was updated successfully, but these errors were encountered: