Skip to content
  • Brad King's avatar
    Add framework to detect compiler version with its id (#12408) · fa7141f5
    Brad King authored
    Teach CMakePlatformId.h to construct an "INFO:compiler_version[]" string
    literal from macros COMPILER_VERSION_(MAJOR|MINOR|PATCH|TWEAK) to be
    defined in CMake(C|CXX)CompilerId.(c|cpp) for each compiler.  Provide
    conversion macros DEC() and HEX() to decode decimal or hex digits from
    integer values.  Parse the version out of the compiler id binary along
    with the other INFO values already present.
    
    Store the result in variable CMAKE_<LANG>_COMPILER_VERSION in the format
    "major[.minor[.patch[.tweak]]]".  Save the value persistently in
    CMake(C|CXX)Compiler.cmake in the build tree.  Document the variable for
    internal use since we do not set it everywhere yet.
    
    Report the compiler version on the compiler id result line e.g.
    
      The C compiler identification is GNU 4.5.2
    
    Report CMAKE_(C|CXX)_COMPILER_(ID|VERSION) in SystemInformation test.
    fa7141f5