title: Why is cmake file GLOB evil?
body: <p>The CMake doc says about the command <a href="https://cmake.org/cmake/help/v3.14/command/file.html?highlight=file#filesystem" rel="noreferrer">file GLOB</a>:</p>
  
  <blockquote>
    <p>We do not recommend using GLOB to collect a list of source files from  your source tree. If no CMakeLists.txt file changes when a source is added or removed then the generated build system cannot know when to ask CMake to regenerate.</p>
  </blockquote>
  
  <p>Several discussion threads in the web second that globbing source files is evil.</p>
  
  <p>However, to make the build system know that a source has been added or removed, it's sufficient to say</p>
  
  <pre><code>touch CMakeLists.txt
  </code></pre>
  
  <p>Right? </p>
  
  <p>Then that's less effort than editing <code>CMakeLists.txt</code> to insert or delete a source file name. Nor is it more difficult to remember. So I don't see any good reason to advise against <code>file GLOB</code>.</p>
  
  <p>What's wrong with this argument?</p>