diff --git a/reference/tools.rst b/reference/tools.rst index f44571a80a4d..227abe37b8fe 100644 --- a/reference/tools.rst +++ b/reference/tools.rst @@ -1747,3 +1747,21 @@ for ``compiler.cppstd=17``, and so on. Parameters: - **settings** (Required): Conanfile settings. Use ``self.settings``. + + +.. _tools.stdcpp_library: + +tools.stdcpp_library(): +----------------------- + +.. code-block:: python + + def stdcpp_library(conanfile) + +Returns the corresponding C++ standard library to link with based on the settings of the given conanfile. For instance, it may return ``c++`` for ``compiler.libcxx=libc++``, + and it may return ``stdc++`` for ``compiler.libcxx=libstdc++`` or ``compiler.libcxx=libstdc++11``. Returns ``None`` if there is no C++ standard library + need to be linked. Usually, this is required to populate ``self.cpp_info.system_libs`` for C++ libraries with plain C API, therefore such libraries might be + safely used in pure C projects (or in general, non-C++ projects capable of using C API, such as written in Objective-C, Fortran, etc.). + +Parameters: + - **conanfile** (Required): ConanFile instance. Usually ``self``.