Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix AutotoolsToolchain compiler_executable unix_paths #13867

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions conan/tools/gnu/autotoolstoolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from conan.tools.build.flags import architecture_flag, build_type_flags, cppstd_flag, build_type_link_flags, libcxx_flags
from conan.tools.env import Environment
from conan.tools.gnu.get_gnu_triplet import _get_gnu_triplet
from conan.tools.microsoft import VCVars, msvc_runtime_flag
from conan.tools.microsoft import VCVars, msvc_runtime_flag, unix_path
from conans.errors import ConanException
from conans.model.pkg_type import PackageType

Expand Down Expand Up @@ -152,7 +152,10 @@ def environment(self):
compilers_mapping = {"c": "CC", "cpp": "CXX", "cuda": "NVCC", "fortran": "FC"}
for comp, env_var in compilers_mapping.items():
if comp in compilers_by_conf:
env.define(env_var, compilers_by_conf[comp])
compiler = compilers_by_conf[comp]
# https://github.com/conan-io/conan/issues/13780
compiler = unix_path(self._conanfile, compiler)
env.define(env_var, compiler)
env.append("CPPFLAGS", ["-D{}".format(d) for d in self.defines])
env.append("CXXFLAGS", self.cxxflags)
env.append("CFLAGS", self.cflags)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,3 +525,17 @@ def test_extra_flags_via_conf():
assert '-mios-version-min=14 --flag1 --flag2' in env["CXXFLAGS"]
assert '-mios-version-min=14 --flag3 --flag4' in env["CFLAGS"]
assert '-mios-version-min=14 --flag5 --flag6' in env["LDFLAGS"]


def test_conf_compiler_executable():
conanfile = ConanFileMock()
conanfile.conf.define("tools.build:compiler_executables", {"cpp": "C:/my/path/myg++"})
conanfile.conf.define("tools.microsoft.bash:subsystem", "msys2")
conanfile.win_bash = True
conanfile.settings = MockSettings(
{"build_type": "Release",
"os": "Windows"})
conanfile.settings_build = conanfile.settings
be = AutotoolsToolchain(conanfile)
env = be.vars()
assert "/c/my/path/myg++" == env["CXX"]