title: CMake: Print out all accessible variables in a script
body: <p>I'm wondering if there is a way to print out all accessible variables in CMake. I'm not interested in the CMake variables - as in the <code>--help-variables</code> option. I'm talking about my variables that I defined, or the variables defined by included scripts.</p>
  
  <p>I'm currently including:</p>
  
  <pre><code>INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake)
  </code></pre>
  
  <p>And I was hoping that I could just print out all the variables that are here, instead of having to go through all the files and read what was available - I may find some variables I didn't know about that may be useful. It would be good to aid learning &amp; discovery. It is strictly for debugging/development.</p>
  
  <p>This is similar to the question in <em><a href="https://stackoverflow.com/questions/2834579/print-all-local-variables-accessible-to-the-current-scope-in-lua">Print all local variables accessible to the current scope in Lua</a></em>, but for CMake!</p>
  
  <p>Has anyone done this?</p>