forked from qt-creator/qt-creator
ProjectExplorer: Include symlinks for compiler import name matching
On macOS /Library/Developer/CommandLineTools/usr/bin/cc is a symlink to /Library/Developer/CommandLineTools/usr/bin/clang, and should not be matched as a GCC toolchain. Fixes: QTCREATORBUG-27523 Change-Id: I8885a263b46fa8d8a8145f7c0faa31f21aae920a Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -1077,12 +1077,19 @@ Toolchains GccToolChainFactory::autoDetect(const ToolchainDetector &detector) co
|
||||
Toolchains GccToolChainFactory::detectForImport(const ToolChainDescription &tcd) const
|
||||
{
|
||||
const QString fileName = tcd.compilerPath.completeBaseName();
|
||||
if ((tcd.language == Constants::C_LANGUAGE_ID && (fileName.startsWith("gcc")
|
||||
|| fileName.endsWith("gcc")
|
||||
|| fileName == "cc"))
|
||||
|| (tcd.language == Constants::CXX_LANGUAGE_ID && (fileName.startsWith("g++")
|
||||
|| fileName.endsWith("g++")
|
||||
|| fileName == "c++"))) {
|
||||
const QString resolvedSymlinksFileName = tcd.compilerPath.resolveSymlinks().completeBaseName();
|
||||
|
||||
const bool isCCompiler = tcd.language == Constants::C_LANGUAGE_ID
|
||||
&& (fileName.startsWith("gcc")
|
||||
|| fileName.endsWith("gcc")
|
||||
|| (fileName == "cc" && !resolvedSymlinksFileName.contains("clang")));
|
||||
|
||||
const bool isCxxCompiler = tcd.language == Constants::CXX_LANGUAGE_ID
|
||||
&& (fileName.startsWith("g++")
|
||||
|| fileName.endsWith("g++")
|
||||
|| (fileName == "c++" && !resolvedSymlinksFileName.contains("clang")));
|
||||
|
||||
if (isCCompiler || isCxxCompiler) {
|
||||
return autoDetectToolChain(tcd, [](const ToolChain *tc) {
|
||||
return tc->targetAbi().osFlavor() != Abi::WindowsMSysFlavor;
|
||||
});
|
||||
@@ -1756,9 +1763,18 @@ Toolchains ClangToolChainFactory::autoDetect(const ToolchainDetector &detector)
|
||||
|
||||
Toolchains ClangToolChainFactory::detectForImport(const ToolChainDescription &tcd) const
|
||||
{
|
||||
const QString fileName = tcd.compilerPath.toString();
|
||||
if ((tcd.language == Constants::C_LANGUAGE_ID && fileName.startsWith("clang") && !fileName.startsWith("clang++"))
|
||||
|| (tcd.language == Constants::CXX_LANGUAGE_ID && fileName.startsWith("clang++"))) {
|
||||
const QString fileName = tcd.compilerPath.completeBaseName();
|
||||
const QString resolvedSymlinksFileName = tcd.compilerPath.resolveSymlinks().completeBaseName();
|
||||
|
||||
const bool isCCompiler = tcd.language == Constants::C_LANGUAGE_ID
|
||||
&& ((fileName.startsWith("clang") && !fileName.startsWith("clang++"))
|
||||
|| (fileName == "cc" && resolvedSymlinksFileName.contains("clang")));
|
||||
|
||||
const bool isCxxCompiler = tcd.language == Constants::CXX_LANGUAGE_ID
|
||||
&& (fileName.startsWith("clang++")
|
||||
|| (fileName == "c++" && resolvedSymlinksFileName.contains("clang")));
|
||||
|
||||
if (isCCompiler || isCxxCompiler) {
|
||||
return autoDetectToolChain(tcd);
|
||||
}
|
||||
return {};
|
||||
@@ -2014,7 +2030,7 @@ Toolchains LinuxIccToolChainFactory::autoDetect(const ToolchainDetector &detecto
|
||||
|
||||
Toolchains LinuxIccToolChainFactory::detectForImport(const ToolChainDescription &tcd) const
|
||||
{
|
||||
const QString fileName = tcd.compilerPath.toString();
|
||||
const QString fileName = tcd.compilerPath.completeBaseName();
|
||||
if ((tcd.language == Constants::CXX_LANGUAGE_ID && fileName.startsWith("icpc")) ||
|
||||
(tcd.language == Constants::C_LANGUAGE_ID && fileName.startsWith("icc"))) {
|
||||
return autoDetectToolChain(tcd);
|
||||
|
Reference in New Issue
Block a user