Create patch - nenetto/CMakeTemplates GitHub Wiki

Now you have an external project added to your solution, and everything works fine. But sometimes, you could want to change some functionalities, extend them or even fix a bug in other's code.

Let say that your friend created a Library a year ago, and she is no longer developing on it. You want to use it, but you discover a bug :beetle: . Your project must run correctly, and if you add your friend's library the bug bothers you.

One option could be download the library, and add to your project as an internal library, but this is not clean...

The recommended option is create a patch.

  1. Clone the repository of your friend's library
  2. Make the changes that you need and commit them to your local repository
  3. Create a patch
  • Open SmartGit
  • Go to the commit that has all the changes to fix the bug and right click
  • Click Create patch and save the file as {Library Name}.patch
  1. Add the library to your SuperBuild project as External dependency
  2. In your SuperBuild Projects folder, copy the patch {Library Name}.patch

That is! :confetti_ball: Now, when you configure and compile your SuperBuild, CMake will download the library respository, and right after will apply the patch fixing the bug :beetle: for you.