-
Notifications
You must be signed in to change notification settings - Fork 105
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
Fix iCub config #670
Fix iCub config #670
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
Ack for this specific change, but to be honest this seems to be a serious usability issue at the YARP CMake level, what do you think @drdanz ? |
Fyi this workaround was already present https://github.com/robotology/icub-main/blob/master/conf/template/icub-config-install.cmake.in#L9 |
I'm sorry if I'm late, but the patch is wrong. TL;DR
Explaination:A user using ONLY iCub libraries, should NOT link explicitly to any YARP target. If YARP libraries are required for compiling/linking a target using iCub libraries, these should be in the If the user is using BOTH YARP and iCub libraries, he should be linking the YARP libraries he is using, but he should not link explicitly the ones required to use iCub targets. As I've been stressing out for several years now, Also, as documented in YARP 3.0.0 release notes (i.e. when components were introduced), the You can now make several Changing the value of this variable inside The user knows which of the YARP libraries are used in his code, not Also if you change the order of the find_package(ICUB) followed by find_package(YARP), the variable will contain only the libraries searched by the latest call. DiscussionThis is not the actual usability issue, because at this point, any YARP user should be aware that he should be using targets instead of the I think that the issue comes from this change in CMake 3.15, and not from #652. The actual change is something like this: --- a/Modules/CMakeFindDependencyMacro.cmake
+++ b/Modules/CMakeFindDependencyMacro.cmake
@@ -31,7 +31,6 @@ CMakeFindDependencyMacro
#]=======================================================================]
macro(find_dependency dep)
- if (NOT ${dep}_FOUND)
set(cmake_fd_quiet_arg)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
set(cmake_fd_quiet_arg QUIET)
@@ -61,5 +60,4 @@ macro(find_dependency dep)
endif()
set(cmake_fd_required_arg)
set(cmake_fd_quiet_arg)
- endif()
endmacro()
The actual problem is that The same issue is valid for any other variable defined inside the config file, and that's yet another reason to prefer targets to variables. I would recommend once again to deprecate this variable once and for all. |
Thanks @drdanz for the very detailed explanation and useful insights 👍 Although it's clear that this approach is far from being optimal and very likely only temporary, this PR aimed to just reinstate an old patch that was there for long as @Nicogene pointed at above. It's fundamental for us to make sure that our huge legacy code won't be broken. This particular condition made actually the compilation of a couple of We will suitably deal with this at the right time and at a larger scale. |
Thanks @drdanz for your digression , what you are saying is correct, using the explicit target respect the The great majority of our community uses cmake in a very basic way, they are not very aware about how the targets works, and which are the differences/advantages of using them explicitly.
This is true, but the status of libraries in |
To be honest I tough the PR was restoring the old value of For the usability problem, the point I was referring to is simply that after https://gitlab.kitware.com/cmake/cmake/-/merge_requests/3161 if I call:
I would expect that the
Not really, to be honest. It is only a problem for variables whose content depend on the arguments passed to the |
I have just restored the old behavior: https://github.com/robotology/icub-main/blob/master/conf/template/icub-config-install.cmake.in#L47 Also before it was appending |
Fine with me 👍 |
I opened an issue upstream: https://gitlab.kitware.com/cmake/cmake/-/issues/20972 |
Based on CMake's upstream response, I am afraid the only viable option is to store and restore the |
Since #652
find_package(ICUB)
shadows previousfind_package(YARP)
calls, this PR fix this problem.Please review code.