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 detect compiler alternative via CC envvar #16187

Merged
Merged
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
5 changes: 3 additions & 2 deletions conan/internal/api/detect_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ def detect_default_compiler():
if cc or cxx: # Env defined, use them
output.info("CC and CXX: %s, %s " % (cc or "None", cxx or "None"))
command = cc or cxx
if "/usr/bin/cc" == command or "/usr/bin/c++" == command: # Symlinks of linux "alternatives"
return _cc_compiler(command)
if "clang" in command.lower():
return detect_clang_compiler(command)
if "gnu-cc" in command or "gcc" in command or "g++" in command or "c++" in command:
Expand Down Expand Up @@ -424,10 +426,9 @@ def _detect_vs_ide_version():
return None


def _cc_compiler():
def _cc_compiler(compiler_exe="cc"):
# Try to detect the "cc" linux system "alternative". It could point to gcc or clang
try:
compiler_exe = "cc"
ret, out = detect_runner('%s --version' % compiler_exe)
if ret != 0:
return None, None, None
Expand Down