-
Notifications
You must be signed in to change notification settings - Fork 71
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
Making CMake/common usable as a .gitmodule in subprojects #551
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.
Looks good. Missing Changelog though. For integration into the projects wrt submodule instead of gitexternals, you would like to that for the release already?
Is there a use case where using subprojects and cloning sub projects needs to be separated? I would have one option for both, SUBPROJECTS=ON as you suggested. |
Right, doing the changelog now. |
@@ -1,8 +1,22 @@ | |||
# CMake Modules | |||
|
|||
This repository contains common CMake modules and a collection of find scripts | |||
to locate non-CMake dependencies. To use it, create a .gitexternals file in your | |||
project with the content: | |||
to locate non-CMake dependencies. The recommended way to use it is: |
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.
As a matter of fact, the only recommended way I would document is the new submodule one. I was considering after we have updated all our projects, we can remove GitExternal.cmake and move what we still need for subproject cloning to SubProject.cmake. If we don't reach a conclusion now, we could discuss this in the next team-meeting.
good to merge? |
+1 from my side |
execute_process(COMMAND "${GIT_EXECUTABLE}" submodule init | ||
WORKING_DIRECTORY "${DIR}" OUTPUT_QUIET) | ||
execute_process(COMMAND "${GIT_EXECUTABLE}" submodule deinit CMake/common | ||
WORKING_DIRECTORY "${DIR}" OUTPUT_QUIET ERROR_QUIET) |
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.
This looks suspicious to me. If you do this and I need to update the CMake/common submodule in my working copy do I need to git submodule init again?
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.
This deinit only applies to subprojects. In for some reason you want to have a clone of CMake/common in a subproject, then yes, you need to init it there. That seems logical to me, do you have a use case in mind where this isn't what you expect?
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.
Not that it deserves attention. I thought it was applying also to the top level CMake/common
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.
no, because the top-level one is cloned directly as a git submodule with clone --recursive, it no longer goes through git externals.
The new CLONE_SUBPROJECTS option offers extra granularity between building with subprojects and clone operations. This is what we discussed today but I am not sure if such fine-grained control is needed. We could also simply replace DISABLE_SUBPROJECTS with a single SUBPROJECTS=ON switch. Both solutions would satisfy the criteria of no clone operations during the configure step by default.