-
Notifications
You must be signed in to change notification settings - Fork 8
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 dependence on git for already checked out submodules #72
Conversation
Thank you for your PR. Under which circumstances do you experience the problem you propose to solve here?
nor with, e.g.,
|
I experience the issue with a docker image I use for building gencmpclient. The docker image does not contain a git executable, and I clone the repo on the host, before using the docker image to build the project. I just tried it again, here is my log, running cmake back to back with a clean repo. (On the host with MacOS, but it does not matter.)
Notice the line "-- fetching git submodule libsecutils" in the second cmake call. After the message() statement in the CMakeLists.txt Edit: To clarify, it is the check "if(GIT_FOUND)" that fails and causes the issue. But it occurs because the check for the CMakeLists.txt is buggy. |
Meanwhile I've been able to reproduce the issue and confirm the fix, both on Linux and MacOS - |
Interesting that you use a Docker image for building under MacOS - why don't you build natively unter MacOS? I'm confused about what you wrote regarding git on Docker: Update:
What do you get on |
I do built natively on MacOS for general development (which works fine). I use the linux docker image for my CI/CD pipeline which is where I noticed the error because I did not add git to the docker image.
I do get |
Motivation
As the path provided to the if(NOT EXISTS) statement in the submodule section is not correct, the following statements will always be executed, as the files will never be found. This causes git to be used no matter what, even if the submodules are already checked out.
This PR fixes this issue by making the path dependent on ${CMAKE_CURRENT_SOURCE_DIR} and enclosing it in double quotes.
Proposed Changes
Use ${CMAKE_CURRENT_SOURCE_DIR} to specify the path to the relevant submodule CMakeLists.txt
Test Plan
Test that it still compiles. Notice that only on the first "cmake" call the submodules are fetched with this fix and the status message "-- fetching git submodule libsecutils" will not appear on subsequent calls.