-
Notifications
You must be signed in to change notification settings - Fork 40
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] FetchContent on missing submodule #262
Conversation
Could you add a unit test in the CI for this feature? |
3a8980b
to
c763bea
Compare
@jcarpent : done |
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.
Perfect! Thanks a lot.
message(STATUS "JRL cmakemodules not found. Let's fetch it.") | ||
include(FetchContent) | ||
FetchContent_Declare("jrl-cmakemodules" | ||
GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git") |
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.
Ideally, you should pull the correct commit too. I don't think it is too hard to get the hash. I am not sure if it is wise to do so.
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.
GIT_TAG
can easily be added, with a branch, a tag, or a hash. But I'm not sure about whether this is best to add one and having to manage it, or if we can just be happy with whatever last version we'll get this way.
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.
I had in mind getting the expected hash from some git command when git is available and the command succeeds and fall back to master
when everything you tried failed.
No, don't add the hash explicitly in the file.
Hi,
This proposition allows users of CMake >= 3.14 to dynamically fetch jrl-cmakemodules when the submodule is not already available.
This also allows eigenpy to be used in other projects with FetchContent, because
FetchContent
is not able to handle submodules at all.eg:
Additional CMake code can also be used to FetchContent only if eigenpy is not already found, with something like: