Skip to content

Commit

Permalink
add conan.tools.gnu.is_mingw()
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceIm committed Dec 8, 2022
1 parent d23c1b4 commit 4614812
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions conan/tools/gnu/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from conan.tools.gnu.autotools import Autotools
from conan.tools.gnu.autotoolstoolchain import AutotoolsToolchain
from conan.tools.gnu.autotoolsdeps import AutotoolsDeps
from conan.tools.gnu.mingw import is_mingw
from conan.tools.gnu.pkgconfig import PkgConfig
from conan.tools.gnu.pkgconfigdeps import PkgConfigDeps
12 changes: 12 additions & 0 deletions conan/tools/gnu/mingw.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def is_mingw(conanfile):
"""
Validate if current compiler in host setttings is related to MinGW
:return: True, if the host compiler is related to MinGW, otherwise False.
"""
host_os = conanfile.settings.get_safe("os")
host_compiler = conanfile.settings.get_safe("compiler")
is_mingw_gcc = host_os == "Windows" and host_compiler == "gcc"
is_mingw_clang = host_os == "Windows" and host_compiler == "clang" and \
not conanfile.settings.get_safe("compiler.runtime")
return is_mingw_gcc or is_mingw_clang

0 comments on commit 4614812

Please sign in to comment.