title: Cmake and ninja rebuild unnecessary files
body: <p>I am starting a Clang tool project, so I built the <strong>LLVM/Clang</strong> from source code using <strong>Cmake</strong> and <strong>ninja</strong>. There are two folders -- <code>src/</code> and <code>build/</code>. Then I created my project folder as <strong>src/tools/clang/tools/extra/my-tool</strong> and added <code>add_subdirectory(my-tool)</code> to the <strong>tools/clang/tools/extra/CMakeLists.txt</strong>. However, every time I modify the file under my project folder and run <code>ninja</code> under <strong>build/</strong>, the system sometimes only builds the modified file but sometimes rebuilds all files (more than 3000 tasks), which is very slow. I am wondering what causes the rebuilding?</p>
  
  <p>BTW, the situation also happens when I modify another project, which uses the Google's Bazel building system. I am suspecting the file time-stamp is changed randomly?   </p>