-
Notifications
You must be signed in to change notification settings - Fork 54
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 > 3.11 and YCM dependency #46
Comments
I am still a bit conflicted regarding how we should recommend to handle optional dependencies such as the YCM in this case. In my experience, taking automatic decision based on whether a package is available on the system or not is typically a source of problems. See robotology/idyntree#322 and robotology/gazebo-fmi#23 for some related discussions. |
I was sure I could use your feedback to extend the minimal example I provided. Thanks for the insights. You caught many of the pitfalls of such system, and particularly your conclusion:
can be atomated by a new macro / function. It would be a great addition to this use-case for dependencies. |
Well, unless you use the fetched content only locally for the sake of the build (which in turn may cause other problem, like interdependencies with other libraries, but this would happen anyway). Am I wrong? |
You are indeed perfectly right, my error is that I taught that this line add_subdirectory(${ycm_SOURCE_DIR}) in that case, indeed there is no problem related to the installation. |
@traversaro YCM is a special case, and the gym-ignition approach only prevents vendoring files (removing the burden to manually update them by time to time). However, what you described in your comment above is completely true in the case that (i) you use |
I totally agree here 👍 Just out of curiosity, what is your opinion about the following scenario: a required version of a library is not found on the system. The user allows for external fetched dependencies and, to avoid corrupting the system with installations, the subject dependency is fetched, compiled and used as a static library, hence just for the sake of building the project. This would probably avoid some trouble and overall the procedure is constrained to the project build. I fear, however, that I'm missing something important 🤔 |
@claudiofantacci In my opinion this is legit if the dependency is |
Sure |
I guess this is ok, but if your project is itself a library, I would recommend to make sure that you properly rename/hide the symbols of the vendored internal static library, to avoid that your project is used with something else that uses another version of the library that you vendor, leading to symbol clashes. These symbol clashes can lead to runtime problems such as the one discussed in simbody/simbody#510 and osqp/osqp#85 . Unfortunately, if you do not want to modify the vendored library, the details on the symbol hiding are platform specific. |
Thanks @traversaro, great insights 👍 |
The current README, for what concerns the YCM dependency, recommends either vendoring the three files we require, or installing YCM externally.
Starting from CMake 3.11, as many of you already know well, a new
FetchContent
module was introduced. It allows downloading and configuring external projects during the configuration phase of the project (contrarily toExternalProject
). Therefore, it is an excellent solution for dependencies like YCM.We should add in the README also this option. Sadly, the default CMake version on the current Ubuntu 18.04 LTS is still 3.10 though.
For a minimal example you can refer to the following implementation:
CMakeLists.txt
BootstrapYCM.cmake
cc @traversaro @claudiofantacci @pattacini @drdanz
The text was updated successfully, but these errors were encountered: