Ffilesystem relies on the C++ standard library (STL) for its implementation as do most C++ programs. STL is a critical part of the C++ programming environment. Computing platforms provide STL in distinct ways:
- Windows MSVC: STL is provided by the Visual Studio C++ compiler.
- Windows MSYS2: STL is provided by GNU libstdc++ or LLVM libc++.
- macOS AppleClang: STL is provided by Xcode and is not a specific file.
- macOS Homebrew: STL is by default the macOS Apple system STL, but can be specified to be Homebrew LLVM libc++ or GNU libstdc++.
Where allowed by the complier/linker/libc++, one can specify the libc++ library like:
cmake -B build -DCMAKE_CXX_FLAGS="-stdlib=libc++"
On Linux systems, STL is provided by default by the GNU libstdc++ library for many (almost all popular) distributions. Other Linux distributions such as Chimera Linux use LLVM libc++.
The STL version might need additional flags to be specified in the build system.
For example, on Linux with Intel oneAPI or NVHPC compilers, libstdc++ is the default STL.
If the STL version is older, linker flags such as -lstdc++fs -lstdc++
might be needed.
A good way to detect this need is by checking the STL version by CMake try_run
or similar, and applying the flags conditionally.
This is done in Ffilesystem cmake/compilers.cmake script.