[CMake] c++2a

Mateusz Loskot mateusz at loskot.net
Tue May 7 03:32:26 EDT 2019


On Tue, 7 May 2019 at 01:15, Angel Campoverde
<campoverdeangelf at gmail.com> wrote:
>
> I am looking at:
>
> https://cmake.org/cmake/help/v3.14/prop_tgt/CXX_STANDARD.html
>
> and I see that I can pass 20, for c++20. However I do not have that in my compiler,
> I only have c++2a and gnu++2a, this means that CMake goes back to c++17

No, it doesn't mean that.

The valid values documented for CXX_STANDARD are CMake generalisation
and not what is directly passed via -std= or /std: or whatever option
your compiler uses.

If you run this cmake command
cmake -DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_EXTENSIONS=OFF ..
and then
VERBOSE=1 make
you will clearly see that CMake generated the compiler
command lines with -std=c++2a

IFF, you are using version of GCC or clang that supports c++2a, obviously
(i.e. GCC 8/clang 6 or later. I'm not entirely confident about clang)

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net


More information about the CMake mailing list