title: Setting CMAKE_CXX_STANDARD to various values
body: <p>I have a C++ library, that's intended to be usable across several compiler versions and several C++ standards. I have tests for this library - and I need to ensure that these tests pass for this matrix of compilers/versions that I wish to support.</p>
  
  <p>I can provide <code>-DCMAKE_CXX_STANDARD=xx</code> (for 11, 14, 17) on the command line, and this seems to work fine. How do I provide a default value for this field? I would like that, if not provided by the user, that default is 11. It seems that when I do:</p>
  
  <pre><code>$ CXX=/path/to/gcc-7 cmake .. -DCMAKE_CXX_STANDARD=17
  # does stuff, CMAKE_CXX_STANDARD is 17
  
  $ CXX=/path/to/gcc-7 cmake .. 
  # does stuff, CMAKE_CXX_STANDARD is still 17
  </code></pre>
  
  <p>which is counterintuitive to me. Is there a way to make the latter use the desired default value of 11?</p>
  
  <p>Also, if I just rerun <code>cmake</code> with a different value in the same build directory, would that be enough to trigger a rebuild or would I need a new build directory?</p>