title: How to produce a list of executables as a separate cmake target
body: <p>I tried my best to add a custom cmake target that compiles a list of .cpp files from a specific folder, and produces an executable for each file, with no success. Basically my scenario is as following:</p>
  <pre><code>foreach (FILE ${EXAMPLE_FILES})
      add_executable(${TARGET_NAME} ${FILE})
  endforeach ()
  </code></pre>
  <p>Currently, when I type <code>cmake .. &amp;&amp; make</code>, everything works fine, all those example files from the list <code>${EXAMPLE_FILES}</code> are compiled, and an executable produced for each. However, I'd like to remove this from the <code>make all</code> target, i.e., I'd like to produce those executables only when I type e.g. <code>make examples</code>. Any idea how to achieve this?</p>