title: Cmake build types (RELEASE, DEBUG, etc.) compiler flags
body: <p>I would like some clarity regarding cmake build types. </p>
  
  <p>Specifically, it isn't clear to me whether setting a build type will also modify the build flags, or whether this is just a "label" that is used internally for the build configuration. For example, in the case of a release build: </p>
  
  <pre><code>set(CMAKE_BUILD_TYPE Release)
  </code></pre>
  
  <p>will the <code>O3</code> flag automatically be specified to the compiler? or do I need to explicitly specify it? </p>
  
  <p>One answer I found sets both the build type and explicitly sets the compiler flags:</p>
  
  <p><a href="https://stackoverflow.com/questions/41361631/optimize-in-cmake-by-default">Optimize in CMake by default</a></p>
  
  <p>But another thread I found online suggests that there are defaults:</p>
  
  <p><a href="https://cmake.org/pipermail/cmake/2016-May/063379.html" rel="nofollow noreferrer">https://cmake.org/pipermail/cmake/2016-May/063379.html</a></p>
  
  <p>If the build type does specify some compiler flags, where can I find documentation for that? I would like to know what flags each build type is setting. </p>
  
  <p>EDIT: </p>
  
  <p>For future reference, if you want to look for the specific flags for your compiler (e.g. gnu in the case of gcc or g++), then you can clone the repo that Kamil references, go into the modules/compilers folder and try a command like:</p>
  
  <pre><code>grep -r _INIT . | grep -i gnu
  </code></pre>
  
  <p>In fact, as Kamil points out, these flags will also be the same as the ones used by Clang since the Clang cmake file includes the GNU one. </p>