title: Use value from C/C++ macro in CMake
body: <p>What is the easiest way to get the value of a C/C++ macro into a CMake variable?</p>
  
  <p>Given I check for a library <code>libfoo</code> with the header <code>foo.h</code>. I know <code>foo.h</code> contains the macro <code>#define FOO_VERSION_MAJOR &lt;version&gt;</code> where version is an integer or string value. To extract the major version of the found library, I want to use the value from this macro.</p>
  
  <p>As a bonus, if the macro is not found, this could indicate a version older then a specific version introducing the version macro.</p>