-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Cmake target_link_libraries unable to find nlohmann_json since version 3.2.0 #1243
Comments
cc @chuckatkins. |
Thanks for reporting and sorry for the inconvenience! The change that introduced the namespace was introduced by @chuckatkins in #1048, and I assumed that the change is fine given that Chuck is with Kitware. Maybe he can comment on the reasons for adding a namespace as I apparently did not understand the repercussions of the change. |
Yes, this is good cmake practice. Just giving a heads up because it is a breaking change for anyone using cmake to build against |
Indeed sorry about the breaking change. The namespace was to transition to more modern CMake practices if namespaced target names being external and non-namespaced target names being "local". Ideally, you'll want to transition to using the namespaced target name when consuming it externally through the config file. In the meantime though, I think I have a quick workaround that can provide both. |
I'll put a version check in place so it's treated as a backward compatibility thing. That way if someone calls |
On our side we started requiring 3.2.0 and adopting the new syntax, so it is not necessary for us. Maybe a note in the release notes? I maintain the conda package and we have patched some recipes that depend on it to pin on 3.1.2. |
We updated from
3.1.2
to3.2.0
. The update causes thetarget_link_libraries
cmake command to not properly includenlohmann_json
, whilefind_package(nlohmann_json REQUIRED)
did not result in an error.After some investigation, it seems that the issue was the addition of namespaces to target names which is a backward incompatible change.
The text was updated successfully, but these errors were encountered: