Skip to content
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

use CMake FetchContent instead of git submodules #752

Open
BenWibking opened this issue Sep 26, 2024 · 0 comments
Open

use CMake FetchContent instead of git submodules #752

BenWibking opened this issue Sep 26, 2024 · 0 comments
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request submodules Pull requests that update Submodules code

Comments

@BenWibking
Copy link
Collaborator

Describe the proposal
Git submodules are painful to use. An alternative is to use CMake's FetchContent feature. That requires specifying the git commit that is needed in the CMakeLists.txt file instead:

FetchContent_Declare(
  googletest
  GIT_REPOSITORY https://github.com/google/googletest.git
  GIT_TAG        703bd9caab50b139428cea1aaff9974ebee5742e # release-1.10.0
)
FetchContent_Declare(
  myCompanyIcons
  URL      https://intranet.mycompany.com/assets/iconset_1.12.tar.gz
  URL_HASH MD5=5588a7b18261c20068beabfb4f530b87
)

FetchContent_MakeAvailable(googletest myCompanyIcons)

This requires that the machine on which you run the cmake .. configure step has internet access, which is not the case on compute nodes on many clusters. However, the configure step could be run on the login nodes, and then the build step (only) can be run on the compute nodes.

The major disadvantage is that GitHub's Dependabot will NOT auto-update the GIT_TAG (shown above) to the latest version on a periodic basis (but see this issue: dependabot/dependabot-core#7451). Currently, we depend on Dependabot to do this weekly.

Describe alternatives you've considered
Keep using git submodules.

Additional context
It is not possible to edit the source code of the dependency for quick testing purposes, since CMake always fetches and uses the version specified in the CMakeLists.txt file:
https://cmake.org/pipermail/cmake/2019-June/069709.html

@BenWibking BenWibking added enhancement New feature or request dependencies Pull requests that update a dependency file submodules Pull requests that update Submodules code labels Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request submodules Pull requests that update Submodules code
Projects
None yet
Development

No branches or pull requests

1 participant