Turning my comment into an answer
-
The CMake team is working on it for VS2017 (as for July 2017, for upcoming CMake version 3.10):
CMake: MSVC standard version switches
Those flags seem to be rather new switches (as related to the date of this question):
VS 2017 15.3 preview now supports /std:c++17
So for Visual Studio you have to “manually” replace or append the compiler switches until CMake officially does support it.
Here is a code snippet that I’ve tested for
std:c++latest
(which is already supported e.g. in my CMake 3.8.0 version):if (MSVC_VERSION GREATER_EQUAL "1900") include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("/std:c++latest" _cpp_latest_flag_supported) if (_cpp_latest_flag_supported) add_compile_options("/std:c++latest") endif() endif()
-
For CLang and GNU the support was merged into the main source code branch begin of 2017 and is part of CMake version 3.8 and above: