

- #Cmake include all but how to#
- #Cmake include all but zip file#
- #Cmake include all but update#
- #Cmake include all but archive#
Alternatively it is the same as downloading a zip file and extracting it into your own project then commiting all the files. It will automatically make a commit when you do that. What git subtree essentially does is to copy the contents of another repository into your own.
#Cmake include all but archive#
If you’re using another kind of source control you can just download your dependencies as an archive (zip) and then extract them relative to your project.
#Cmake include all but update#
I prefer the git subtree as it is easier to update and allows you to modify dependencies without pushing anything back to the original repository. Read more: Git Submodules official documentation Git Subtree or Zip download Use this approach with your own managed repositories because you may find useful to make imrpovements on them and commit them back directly to their main repo. You can also easily commit back to the initial repository. What is most useful about the git submodule approach is that it doesn’t keep track of the contents of the repository it just keeps a reference. Git then provides a whole set of commands to update this reference and download the contents of that repository into the directory. The git submodule approach will make a directory in your git repository to reference another repository available in the internet. You can use the “git submodule” or “git subtree” sets of commands if you are under Git SVN. There are a few aproaches to taking your dependencies for this approach. You can also split your code the same way into consumable modules and even make different repositories for each module so that you can reuse them in the future. So in thery if you download your dependency as a subdirectory to your project you can add it and then link the library to your executable. The command add_subdirectory in CMake language does only one thing – takes the directory path relative to the current CMakeLists.txt directory and executes the CMakeLists.txt in that directory.


You would be wise to do that by seperating them into their own directories. Read more on those in my CMake targets article before you proceed. In CMake projects you can split your code into chunks (libraries) and then add executables (application or tests). Keep in mind that there are other ways to use packages and managing dependencies but I like this approach as it puts all dependecies at the same relative level in your project and it is more clear and easier for initial compilation. My approach when managing dependencies without a tool like vcpkg is to add them as subdirectories.
#Cmake include all but how to#
I expect that you are already familiar with how CMake works and how to write code in C/C++. It is also mainly useful when dependencies are also managed with CMake too but it is not required. The approach described in this article is useful when you want to secure your dependencies will always be the correct version and you want to compile them alongside your project. Check out my other tutorial on how to manage them using a package manager. Keep in mind thtat this is the harder approach in some way to managing dependecies.
