Skip to content

Wrapping C++ std::filesystem implementation libraries in a custom dependency #14249

Open
@bgs99

Description

Some compiler vendors have implemented the <filesystem> support in a separate library from the rest of the STL, which is not linked automatically.

As far as I can tell, this includes libstdc++, requiring libstdc++fs for versions older than 9.1, and libc++, requiring libc++fs for versions older than 9.0.
https://en.cppreference.com/w/cpp/filesystem (see Notes at the bottom)

While the affected toolchains are several major versions behind the current ones, they are still used by some LTS OS releases such as Debian (https://packages.debian.org/buster/libstdc++-8-dev)

So, the projects that need to support these toolchains / OSes have to write a lot of complex boilerplate to detect which (if any) filesystem implementation library needs to be linked in and exported.

It would be great if Meson could absorb this complexity and allow its users to write something like

cxx_filesystem_dep = dependency('cxx-filesystem')

similar to how Meson handles the threads lookup.

For reference, here is the relevant CMake discussion about this feature:
https://gitlab.kitware.com/cmake/cmake/-/issues/17834

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions