Skip to content

Conversation

@gillamkid
Copy link

CPM does passthrough for many of the argument options of cmake's FetchContent() function. Hwever, there was an argument of interest that it was not passing: GIT_SUBMODULES.

GIT_SUBMODULES is needed if you want to use CPMAddPackage() and have it not initialize the submodules of the repo.

I added support so GIT_SUBMODULES "" can be used to prevent submodules from being initialized the same way it is used to do so when calling FetchContent() directly.

@TheLartians
Copy link
Member

TheLartians commented Jan 19, 2026

Thanks for raising the issue! We should definitely support this edge case. Three things

  • Can you add a test case so we don't break this accidentally?
  • The issue is not specific to GIT_SUBMODULES issue will happen any time someone tries to pass an empty string to a forwarded parameter. Do you think there's a way we can make this a more general fix? E.g. writing a wrapper for cmake_parse_arguments that ensures empty arguments are preserved?
  • Please run the code formatter (see CONTRIBUTING.md)

@TheLartians
Copy link
Member

@gillamkid note that this issue is also handled by #461, which resolves the issue in a more general way. The PR has gone stale due to lack of time from my side, but given the obvious need for a fix I will prioritise it.

@gillamkid gillamkid force-pushed the git-submodules-passthrough branch from 08f6972 to fc0d339 Compare January 24, 2026 23:27
@gillamkid
Copy link
Author

I added some unit tests and fixed the styling. @TheLartians can you please approve the Gitlab Actions workflow to run?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants