diff --git a/reference/conanfile/tools/gnu.rst b/reference/conanfile/tools/gnu.rst index 5984334071c..0bba1e4f247 100644 --- a/reference/conanfile/tools/gnu.rst +++ b/reference/conanfile/tools/gnu.rst @@ -14,5 +14,6 @@ conan.tools.gnu gnu/autotoolsdeps gnu/autotoolstoolchain gnu/autotools + gnu/mingw gnu/pkgconfigdeps gnu/pkgconfig diff --git a/reference/conanfile/tools/gnu/mingw.rst b/reference/conanfile/tools/gnu/mingw.rst new file mode 100644 index 00000000000..739c8916b3a --- /dev/null +++ b/reference/conanfile/tools/gnu/mingw.rst @@ -0,0 +1,27 @@ +.. _conan_tools_gnu_mingw: + +conan.tools.gnu.is_mingw() +-------------------------- + +Available since: `1.57.0 `_ + +.. code-block:: python + + def is_mingw(conanfile): + +Check whether ``self.settings`` is a MinGW compiler. +It returns ``True`` when host os is ``Windows`` and host compiler is ``gcc`` or ``clang`` +and ``compiler.runtime`` is not set, otherwise returns ``False``. +When the ``compiler`` is empty, it returns ``False``. + +Parameters: + +- **conanfile**: ConanFile instance. + +.. code-block:: python + + from conan.tools.gnu import is_mingw + + def build(self): + if is_mingw(self): + # some logic to build with mingw