[CMake] Setting CXX_STANDARD 11 Enables GNU Extensions

Scott Aron Bloom scott at towel42.com
Sat Jul 4 03:16:57 EDT 2015


This is why I don’t use the CXX_STANDARD and instead use the CXX_FLAGS and add the flag I need.

From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of digitalriptide
Sent: Friday, July 3, 2015 1:56 PM
To: cmake at cmake.org
Subject: [CMake] Setting CXX_STANDARD 11 Enables GNU Extensions

If I enable C++11 for some target via
set_target_properties( SomeTarget PROPERTIES CXX_STANDARD 11 )
set_target_properties( SomeTarget PROPERTIES CXX_STANDARD_REQUIRED ON )
with GCC, the code will then compile with -std=gnu++11. Compiling with -std=gnu++11 enables C++11 *and* the GNU extensions. Is there an option that will result in -std=c++11 in lieu of -std=gnu++11, to build without the the GNU extensions?

Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150704/8021489d/attachment.html>


More information about the CMake mailing list