MantisBT - CMake
View Issue Details
0011682CMakeCMakepublic2011-01-11 08:322011-01-15 20:56
Maddes 
Brad King 
normalfeatureN/A
closedduplicate 
MinGW/GCCWindows XPx86, SP3
CMake 2.8.3 
 
0011682: [enhancement] Add GNU versions for CMakeLists.txt processing, just like MSVC_VERSION
It would be great to determine the version of the GNU compiler, so that options can be avoided for older/newer versions of GCC and G++ (e.g. -Wextra, etc.).
A similar variable for VisualC++ already exists: MSVC_VERSION.

GCC/G++ already provide their version number via the macro definitions __GNUC__ (=major), __GNUC_MINOR__, __GNUC_PATCHLEVEL__.

Having GNU<LANG>_MAJOR, GNU<LANG>_MINOR, GNU<LANG>_PATCHLEVEL available for use in CMakeLists.txt would be very useful.
No tags attached.
duplicate of 0006251closed Brad King Provide compiler version information 
Issue History
2011-01-11 08:32MaddesNew Issue
2011-01-11 08:41Brad KingRelationship addedduplicate of 0006251
2011-01-11 08:47Brad KingNote Added: 0024575
2011-01-11 08:47Brad KingStatusnew => closed
2011-01-11 08:47Brad KingAssigned To => Brad King
2011-01-11 08:47Brad KingResolutionopen => duplicate

Notes
(0024575)
Brad King   
2011-01-11 08:47   
This would be a great feature.

Closing as duplicate of 0006251. You can monitor that issue instead.

Here are some alternatives to use for your case, useful when CMAKE_C_COMPILER_ID is GNU:

 - Use execute_process to run "gcc --version"
 - Do your own try_compile to detect the GCC version number
 - Use the CheckCCompilerFlag to detect support for specific flags