[CMake] Running Custom command only on files that have changed

Michael Jackson mike.jackson at bluequartz.net
Thu Apr 2 19:25:09 EDT 2015


The basics of what I want to do is the following:

Use git to get a list of files that have changed (git status?)
Pipe those files into a custom program that does some code cleanup & formatting.

What I am not sure how to do is entice git to give me a list of files that is easy for cmake to parse? Has anyone ever done anything like this before? I want to use AStyle to ensure our source files are consistently formatted before they are checked into our git repo. I don't want to just blanket hit every single file either as that may make for some large commits that hide what is really changing. 

Maybe this is just a really bad idea in general. I'd appreciate any comments either way.

Thanks
Mike Jackson
BlueQuartz Software, LLC



More information about the CMake mailing list