CMake builds for modern C++14, C++17, C++20

Non-standard language options and incomplete feature support are normal for compilers across virtually all programming languages from BASIC to Fortran and here C++. Modern C++ features typically require using specific compiler flags to enable support. Knowing what compiler flags to set can be confusing for those new to modern C++ features. Setup of C++ compiler flags for modern C++ features is easily and automatically handled by CMake or Meson.

set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_executable(filesep_cpp filesep.cpp)
set_property(TARGET filesep_cpp PROPERTY CXX_STANDARD 17)

Compilers supporting C++17 filesystem include:

  • g++ ≥ 8
  • clang++
  • Microsoft Visual Studio