Am Sonntag, 6. Mai 2018, 08:00:14 schrieb Andrew Brownsword: > 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.
My bet is: that code is wrong. For every compiler I have seen the rules have been: -std=c++AA is used as long as the standard is not fixed -afterwards std=c++YY is introduced, and -std=c++AA is an alias for that So it does not matter which flag you use when the compiler supports both, but you can't of course properly test on the value of __cplusplus in older compilers because you don't know in which year/month the standard will be released. Eike
signature.asc
Description: This is a digitally signed message part.
-- 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: https://cmake.org/mailman/listinfo/cmake