rpavlik/cmake-modules

git revision description only trigger rebuild of one file

nickjmeyer opened this issue · 1 comments

I've been using your git revision description module. Works great!

If I understand this module correctly, it watches files in .git/ and then copies them to CMakeFiles/ which then triggers a rebuild.

Since it triggers a complete rebuild, I simply include the description variable as a preprocessor macro.

I'm wondering if there is a way to trigger a rebuild of only one file. Perhaps have a git_revision.cpp.in that looks like

#include "git_revision.hpp"

const static std::string git_revision = "@git_description@";

and git_revision.hpp

#ifndef GIT_REVISION_HPP
#define GIT_REVISION_HPP

const static std::string git_revision;

#endif

and only trigger a rebuild of git_revision.cpp when a committ, pull, etc. occurs.

Any ideas?

Just found your post on SO. Perfect! Thanks!

http://stackoverflow.com/a/4318642/1980818