[CMake] Enabling C++0x support

Sean McBride sean at rogue-research.com
Wed May 4 18:15:37 EDT 2011


On Wed, 4 May 2011 23:58:56 +0200, Guido Winkelmann said:

>Is there a way to specify, in a cross-platform compatible manner, that a
>given 
>C++ source file (or a target or an entire project) requires support for C
>++ 0x, 
>so that whatever compiler flags would be necessary for that for the current 
>platform and compiler will be set?
>
>For example, when using GCC, you need to pass "-std=c++0x" as an argument to 
>the compiler in order to get C++0x support. I could just set(CMAKE_CXX_FLAGS 
>"-std=c++0x"), but that's not really portable... the current platform might 
>use a different compiler that needs a different option to enable C++ 0x and 
>won't understand "-std=c++0x", or, at some point in the future, it might
>use a 
>GCC release which makes 0x the default and does not even need a special flag.

It would indeed be nice to have such a thing.  VTK currently has a
similar problem where it passes -std=c99, a gcc flag unrecognised by clang:
<http://vtk.org/Bug/view.php?id=11952>

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada




More information about the CMake mailing list