[Scons-users] How to check if the C++ compiler supports `override`?

Carsten Fuchs carsten.fuchs at cafu.de
Mon Aug 4 15:06:35 EDT 2014


Hi all,

sorry if this is a trivial question, but I couldn't find the answer in 
the manual or in the man page:

How can I find out (in the SConstruct script) if the (Linux) C++ 
compiler supports the `override` identifier?

The only C++ compilers that I support in my project are Visual C++ 2005 
(VC8) and newer under Windows, all of which support the `override` 
specifier, and g++ under Linux, which supports `override` only in 
version 4.7 and newer. However, Ubuntu 12.04 still comes with g++ 4.6, 
which I would like to support for quite a while.

So for the g++ compiler versions, my initial plan was to check if the 
CXXVERSION variable of the SCons environment matches the required 
version (which in turn requires some parsing of the version string), but 
I was wondering if there is a better solution to this problem? For 
example, can I check for the `override` identifier in a more direct 
manner than only via the compiler version?

Any hints and help would much be appreciated!  :-)

Best regards,
Carsten



More information about the Scons-users mailing list