[cmake-developers] [CMake 0015417]: CMAKE_C_COMPILER_VERSION is wrong due to a bug in gcc

Mantis Bug Tracker mantis at public.kitware.com
Tue Feb 24 10:05:30 EST 2015


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=15417 
====================================================================== 
Reported By:                Christophe Dumeunier
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15417
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-02-24 10:05 EST
Last Modified:              2015-02-24 10:05 EST
====================================================================== 
Summary:                    CMAKE_C_COMPILER_VERSION is wrong due to a bug in
gcc
Description: 
I suppose CMAKE_C_COMPILER_VERSION and CMAKE_CXX_COMPILER_VERSION are obtained
from the maccros __GNUC__, __GNUC_MINOR__ and __GNUC_PATCHLEVEL__. It seems that
gcc 4.5.1 has a bug : __GNUC_PATCHLEVEL__ is set to 0 instead of 1. It implies
that CMake is wrong when loading the compiler information from gcc 4.5.1. Maybe
the version should be checked with the maccro __VERSION__, or obtained directly
from the command "gcc --version".

Steps to Reproduce: 
Simply create a project compiled with gcc 4.5.1 using C or CXX.

The bug of gcc can be observed with the following C++ code :
#include <iostream>
int main(int argc, char** argv)
{
  std::cout << __GNUC__ << "." << __GNUC_MINOR__ << "." << __GNUC_PATCHLEVEL__
<< std::endl;
  return 0;
}

Additional Information: 
Note that gcc 4.5.1 is the default compiler on openSUSE 11.4.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-02-24 10:05 Christophe DumeunierNew Issue                                  
 
======================================================================



More information about the cmake-developers mailing list