title: Getting cmake to run before building after pulling from git
body: <p>There is this project kept in a git repository, which we build with cmake and ninja.
  We are using globbing expressions/functions to collect all the source files to be compiled. That means that every time a file is added/removed, cmake has to be called to re-parse the directories.</p>
  
  <p>We have seen this is bringing some time loss when somebody pulls after somebody has pushed some new file, without modifications to any of the cmake files. I say this last thing because a modification to any of the cmake files would trigger a call to cmake (by ninja), and everything would be fine.</p>
  
  <p><strong>How can I obtain that cmake is called before/when I start building again my project after pulling?</strong>
  (Note: it does not matter if cmake is run a little bit more than necessary, as long as it is not always)</p>
  
  <p>I am building out of source, furthermore using several build directory where for example I test different compilers.</p>
  
  <p>I am exploring some solutions. One using git hooks script, namely post-merge (but how can I guarantee I will retrieve the path to source/CMakeLists.txt to <em>touch</em> it? Can I commit the script so that it runs for everybody? It is not a public project). I don't know if it is relevant, we mainly use git through graphic interface (TortoiseGit).</p>
  
  <p>The other possible solution would be using in cmake a custom target dependent on the content of .git\refs\heads directory, but I cannot think of a combination that could really work...</p>
  
  <p>Some links:</p>
  
  <ol>
  <li><a href="http://git-scm.com/book/en/Customizing-Git-Git-Hooks" rel="nofollow">http://git-scm.com/book/en/Customizing-Git-Git-Hooks</a></li>
  <li><a href="https://www.kernel.org/pub/software/scm/git/docs/githooks.html" rel="nofollow">https://www.kernel.org/pub/software/scm/git/docs/githooks.html</a></li>
  </ol>
  
  <p>CMake commands: <a href="http://www.cmake.org/cmake/help/v2.8.11/cmake.html" rel="nofollow">http://www.cmake.org/cmake/help/v2.8.11/cmake.html</a></p>