[CMake] -std=c++17 vs -std=c++1y

Andrew Brownsword andrew.e.brownsword at gmail.com
Sun May 6 13:34:49 EDT 2018


Well, I am specifying:

set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS ON)

and the compiler line contains “-std=gnu++1y”.  I’m using a very recent source build of CLang and libc++.  Any idea why cmake would fall back to 1y in this case?





> On May 6, 2018, at 9:05 AM, Jean-Michaël Celerier <jeanmichael.celerier at gmail.com> wrote:
> 
> Note that c++17 is c++1z. c++1y was C++14.
> 
> 
> 
> -------
> Jean-Michaël Celerier
> http://www.jcelerier.name <http://www.jcelerier.name/>
> On Sun, May 6, 2018 at 5:00 PM, Andrew Brownsword <andrew.e.brownsword at gmail.com <mailto:andrew.e.brownsword at gmail.com>> wrote:
> Hi,
> 
> Is there a way to get cmake 3.11 to emit 17 vs 1y when setting CMAKE_CXX_STANDARD?  I’m finding that it seems to be a common practice to use the value of the preprocessor define __cplusplus (which is a date), and the value differs depending on whether 17 or 1y is used (at least with CLang).  I haven’t figured out how to get cmake to emit -std=c++17, it always seems to use 1y, which is causing problems with code that assumes the __cplusplus date reflects the c++17 standardization date.
> 
> Thanks,
>    Andrew
> 
> -- 
> 
> Powered by www.kitware.com <http://www.kitware.com/>
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ <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 <http://cmake.org/cmake/help/support.html>
> CMake Consulting: http://cmake.org/cmake/help/consulting.html <http://cmake.org/cmake/help/consulting.html>
> CMake Training Courses: http://cmake.org/cmake/help/training.html <http://cmake.org/cmake/help/training.html>
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html <http://www.kitware.com/opensource/opensource.html>
> 
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake <https://cmake.org/mailman/listinfo/cmake>
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180506/beea516d/attachment.html>


More information about the CMake mailing list