Replies: 1 comment 1 reply
-
|
If I understand the use-case correctly, you essentially want to create a directory containing all dependencies without their according version control data and commit that into a monorepo? In general I'm not sure if this fits into the scope of CPM.cmake, especially as we are generally interested in keeping the version control information, for example to implement #274. Adding such options would increase the complexity of similar additional features. Imo I think a better approach would be to write a short script to remove any version control directories inside the local |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
As the title says, I'm looking to use CPM to vender 3rd party libraries. Placing
CPM_SOURCE_CACHEwithin my application's repository gets me 95% of the way there, but there's one little speed hump that I'd like to eliminate if possible.Currently, when CPM clones a Git repository into
CPM_SOURCE_CACHE, the repository (i.e. the.gitdirectory) is retained - that's just what the underlying CMake functions do. This is an issue when adding the library to my application's repository, as shown by the error message whengit adding it:Obviously, I can manually remove the
.gitdirectory, but I've been thinking about how achieving this might be incorporated into CPM. I've thought of a few mechanisms that could be used to achieve this:Remove the
.gitdirectory afterFetchContent_Populatehas been used to clone the repositoryThis is just what I do manually and is pretty simple to accomplish - I've got a PoC of this approach, which removes git repo directories when a variable (
CPM_GIT_REMOVE) is set. It just feels... inelegant.Use
git subtreeorsubmoduleto incorporate the library's repository into my application's repository.This has the advantage of retaining where the library came from. However, it modifies the application's repository by running CMake, which doesn't feel like the right thing to do.
Clone the repository to a temp. directory and use
git archiveto copy out the desired commit's filesThe canonical way to do this would be to do something like:
However, given Windows, you'd probably want to archive to a file and then use CMake to extract the archive to the desired directory. This is starting to feel a bit like too many moving parts to me...
update parser version #3, but use
git checkout-indexinstead ofgit archiveForget about update parser version #3 -
checkout-indexdoes what's needed directly.I guess the question is - is this something that could go in CPM? I'm happy enough to come up with a PR to implement, but it's more about whether this is something you'd be happy having in CPM.
Beta Was this translation helpful? Give feedback.
All reactions