Interoperability with git submodules #584
kainiederhagen
started this conversation in
Ideas
Replies: 1 comment
-
I am happy to contribute an implementation to the project if such a thing is considered useful. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My use case is that I have a mixture of dependencies brought in by git submodules and others that I'd like to bring in via CPM. Both might be the same git repository.
Let me explain.
I am working on software that is compiled for embedded software as well as for a simulator that emulates the embedded system using logged data read from files. This simulator runs under windows/linux.
The embedded compilation is not done by cmake, the simulation is done by cmake.
This seems to be a pretty common situation, I have experienced similar setups in several companies I worked for.
Additionally the whole system is split into smaller modules that live in separate git repositories. These modules have individual CI running and developers of this module want to build and test it in isolation. These tests and CI builds are driven by CMake as well.
Embedded build
A root git project has everything it needs to build added as git submodules. Nothing can be fetched from the internet.
Simulation
Uses the same root git project but is build using cmake. The git submodules are present.
A mechanism is needed to ensure that the submodules versions match the requirements of other submodules.
Module developer / Ci builds
A module might have a dependency that the root project might provide that is needed to be build in isolation as well. Since this dependency is only needed by developer / CI builds I want to utilize CPM to not have recursive submodules in my root project.
Requirements
This leads to requirements stemming from the use cases. Mainly I want to achieve a version control of dependencies added via add_subdirectory() from git submodules and dependencies added via the CPM fetch functionality.
Proposal
I would like to have a CPM function CPMRegisterGitProject() that allows me to register the current folders git project to CPM.
This way my project can actively support CPM being used:
If implemented as a macro this might even use the return() statement to stop the current CMakeLists.txt file from being executed should the dependency already exist.
CPMRegisterGitProject() should get the git tag from the CMAKE_CURRENT_LIST_DIR and use it to call CPMRegisterPackage()
This way calls to CPMAddPackage() nicely work together with projects added via add_subdirectory().
The CPM warnings about too old versions would be given and useful.
Beta Was this translation helpful? Give feedback.
All reactions