b.buchhold
b.buchhold

Reputation: 3906

Preferred way to add a third party library to a git project

Say I am using gtest and I usually included the sources in my project (and cmake) so that they were built locally - as recommended.

What is the preferred way to add this to a (public) git repositry (e.g., on GitHub). Add the thrid party code as well (in a subfolder)? I'm used to working on private svn repositories where we just followed this approach. Not sure if it is recommended for public projects. On top of that, frameworks will include their licences but I'm not sure if I have to explicitly reference them in the project root as well.

Is it possible to reference the code for the framework somehow, i.e. do not commit the code but make checkouts or project builds donwload framework code as needed? Is it better pratice to simply state that there is a dependency and let everyone handle it locally?

Upvotes: 4

Views: 2887

Answers (1)

Gaston
Gaston

Reputation: 1848

You could use git submodules to reference dependencies.

Git submodules allows you to include a completely different repository on a given directory and keep only the reference.

http://git-scm.com/book/en/v2/Git-Tools-Submodules

Upvotes: 2

Related Questions