title: Unit testing as part of the build
body: <p>I have a CMake project separated in three parts:</p>
  
  <ol>
  <li>Compilation of my libraries</li>
  <li>Compilation of many unit tests programs testing each precise subpart of those libraries</li>
  <li>Compilation of program samples using those libraries</li>
  </ol>
  
  <p>My question is about the 2<sup>nd</sup> part. My unit tests executables are short binary programs with a <code>main</code> returning 0 on success, 1 on fail. I would like to integrate their running as part of the build.</p>
  
  <p>Is it possible to use CMake to do one of those two solutions:</p>
  
  <ul>
  <li>Run every unit test program and check return values and generate an error if any fail.</li>
  <li>Generate a test script that would run and check every unit test program and check return values to yield an error if any fail.</li>
  </ul>
  
  <p>I'm not looking for a complete CMake script code, a simple indication on what is possible with a link to corresponding documentation would be enough.</p>