title: Confused about CMake's cached variable setting priority
body: <p>I'm confused about CMake's cached variables:</p>
  
  <ul>
  <li><p>Case 1: <code>CACHE</code> + <code>FORCE</code></p>
  
  <pre><code>set(CMAKE_CXX_FLAGS "myflags" CACHE STRING "" FORCE)
  </code></pre>
  
  <ul>
  <li><strong>First CMake run:</strong> <code>"myflags"</code> appears in the <code>CMakeCache.txt</code> file as intended.</li>
  <li><strong>Command line options:</strong> command line options do not override <code>"myflags"</code> - seems like <code>FORCE</code> has higher priority than command line <code>-D...="..."</code> arguments. This is not desired - I would like command line arguments to override <code>"myflags"</code>.</li>
  </ul></li>
  </ul>
  
  <hr>
  
  <ul>
  <li><p>Case 2: only <code>CACHE</code></p>
  
  <pre><code>set(CMAKE_CXX_FLAGS "myflags" CACHE STRING "")
  </code></pre>
  
  <ul>
  <li><strong>First CMake run:</strong> nothing appears in the <code>CMakeCache.txt</code> file. I want<code>"myflags"</code> to appear for the first run.</li>
  <li><strong>Command line options:</strong> command line have priority over <code>"myflags"</code>.</li>
  </ul></li>
  </ul>
  
  <hr>
  
  <p><strong>Am I correct about my conclusions? Or do "default variables" such as <code>CMAKE_CXX_FLAGS</code> behave differently?</strong></p>
  
  <p><strong>Is there a way to have <code>"myflags"</code> written in the <code>CMakeCache.txt</code> file during the first CMake run (when CMake wasn't run previously in this folder)?</strong> </p>
  
  <p>I'd like to set <code>"myflags"</code> during the first CMake run in the cache, then allow the user to override it using the command line. </p>
  
  <p>If I use <code>FORCE</code>, the user can't override it via command line.</p>
  
  <p>If I don't use <code>FORCE</code>, <code>"myflags"</code> isn't written in the cache file during the first run.</p>