[CMake] Setting CXX_STANDARD 11 Enables GNU Extensions

Michael Jackson mike.jackson at bluequartz.net
Sun Jul 5 12:07:15 EDT 2015


Is there a project wide CXX_STANDARD_REQUIRED that I can set? I am wanting to migrate our project to C++ 11 and would rather set something in the project root rather than find every place where our own and our customers plugin codes create a target.

Thanks
Mike Jackson

On Jul 4, 2015, at 5:13 PM, digitalriptide <digitalriptide at gmail.com> wrote:

> Thank you for the pointers, adding 
> set( CMAKE_CXX_EXTENSIONS OFF )
> to the root CMakeLists.txt disabled the extensions through the project.
> 
> On Sat, Jul 4, 2015 at 3:52 PM, Thompson, KT <kgt at lanl.gov> wrote:
> Try setting CMAKE_CXX_EXTENSIONS this to OFF.
> 
>  
> 
> http://www.cmake.org/cmake/help/v3.2/prop_tgt/CXX_EXTENSIONS.html#prop_tgt:CXX_EXTENSIONS
> 
>  
> 
> From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Scott Aron Bloom
> Sent: Saturday, July 04, 2015 1:17 AM
> To: digitalriptide; cmake at cmake.org
> Subject: Re: [CMake] Setting CXX_STANDARD 11 Enables GNU Extensions
> 
>  
> 
> 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!
> 
> 
> -- 
> 
> Powered by www.kitware.com
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
> 
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150705/22ea205b/attachment.html>


More information about the CMake mailing list