Sign up for the KDAB Newsletter
Stay on top of the latest news, publications, events and more.
Go to Sign-up


Find what you need - explore our website and developer resources
11 January 2023
If you want to use some other git projects in your code base, you have a few competing options.
The, by far, simplest one is to just copy the code in but that has the problem that updates to the original code are a bit of work to get into your code base.
A much better alternative is to make the code into a git sub-module.
This episode will show you how to do just that, using the kdalgorithms git-hub module.
Further, it will also tell you a few tricks to make working with sub-modules easier in CMake projects
Links:
* Header only libraries: http://mariobadr.com/creating-a-header-only-library-with-cmake.html
* Git Submodules documentation: https://git-scm.com/book/en/v2/Git-Tools-Submodules
* Why you can't add a submodule via a file: https://bugs.launchpad.net/ubuntu/+source/git/+bug/1993586
* KDAlgortihms on github: https://github.com/KDAB/KDAlgorithms
0:00 Introduction
2:40 Initial git clone
4:08 Adding the sub-module
7:07 Commit the changes
7:40 Doing a clean checkout - sub-module missing
10:53 CMake function: CheckSubmoduleExists
13:47 git clone --recursive-submodules
The example code showcased in this video is available here: https://github.com/KDAB/kdabtv/tree/master/Qt-Widgets-and-more/git-submodules
All QML tips and tricks videos : https://www.youtube.com/playlist?list=PL6CJYn40gN6jWHP5krsQrVGyYtKh3A3be
All Qt Widgets and more videos:
https://www.youtube.com/playlist?list=PL6CJYn40gN6gf-G-o6syFwGrtq3kItEqI