title: Get full C++ compiler command line
body: <p>In CMake, the flags for the C++ compiler can be influenced in various ways: setting <code>CMAKE_CXX_FLAGS</code> manually, using <code>add_definitions()</code>, forcing a certain C++ standard, and so forth.</p>
  
  <p>In order to compile a target in the same project with different rules (a precompiled header, in my case), I need to reproduce the exact command that is used to compile files added by a command like <code>add_executable()</code> in this directory.</p>
  
  <p>Reading <code>CMAKE_CXX_FLAGS</code> only returns the value set to it explicitly, <code>CMAKE_CXX_FLAGS_DEBUG</code> and siblings only list default Debug/Release options. There is a special functions to retrieve the flags from <code>add_definitions()</code> and <code>add_compiler_options()</code>, but none seem to be able to return the final command line.</p>
  
  <p>How can I get all flags passed to the compiler into a CMake variable?</p>