I\'m using VS 15.3, which supports integrated CMake 3.8. How can I target C++17 without writing flags for each specific compilers? My current global settings don\'t work:
You can also use target_compile_options to set /std:c++latest flag for Visual Studio 2019
if (MSVC_VERSION GREATER_EQUAL "1900")
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("/std:c++latest" _cpp_latest_flag_supported)
if (_cpp_latest_flag_supported)
target_compile_options(${TARGET_NAME} PRIVATE "/std:c++latest")
endif()
endif()
Replace ${TARGET_NAME} with the actual target name.