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
|
Toolchains GccToolChainFactory::detectForImport(const ToolChainDescription &tcd) const
|
||||||
{
|
{
|
||||||
const QString fileName = tcd.compilerPath.completeBaseName();
|
const QString fileName = tcd.compilerPath.completeBaseName();
|
||||||
if ((tcd.language == Constants::C_LANGUAGE_ID && (fileName.startsWith("gcc")
|
const QString resolvedSymlinksFileName = tcd.compilerPath.resolveSymlinks().completeBaseName();
|
||||||
|| fileName.endsWith("gcc")
|
|
||||||
|| fileName == "cc"))
|
const bool isCCompiler = tcd.language == Constants::C_LANGUAGE_ID
|
||||||
|| (tcd.language == Constants::CXX_LANGUAGE_ID && (fileName.startsWith("g++")
|
&& (fileName.startsWith("gcc")
|
||||||
|| fileName.endsWith("g++")
|
|| fileName.endsWith("gcc")
|
||||||
|| fileName == "c++"))) {
|
|| (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 autoDetectToolChain(tcd, [](const ToolChain *tc) {
|
||||||
return tc->targetAbi().osFlavor() != Abi::WindowsMSysFlavor;
|
return tc->targetAbi().osFlavor() != Abi::WindowsMSysFlavor;
|
||||||
});
|
});
|
||||||
@@ -1756,9 +1763,18 @@ Toolchains ClangToolChainFactory::autoDetect(const ToolchainDetector &detector)
|
|||||||
|
|
||||||
Toolchains ClangToolChainFactory::detectForImport(const ToolChainDescription &tcd) const
|
Toolchains ClangToolChainFactory::detectForImport(const ToolChainDescription &tcd) const
|
||||||
{
|
{
|
||||||
const QString fileName = tcd.compilerPath.toString();
|
const QString fileName = tcd.compilerPath.completeBaseName();
|
||||||
if ((tcd.language == Constants::C_LANGUAGE_ID && fileName.startsWith("clang") && !fileName.startsWith("clang++"))
|
const QString resolvedSymlinksFileName = tcd.compilerPath.resolveSymlinks().completeBaseName();
|
||||||
|| (tcd.language == Constants::CXX_LANGUAGE_ID && fileName.startsWith("clang++"))) {
|
|
||||||
|
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 autoDetectToolChain(tcd);
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
@@ -2014,7 +2030,7 @@ Toolchains LinuxIccToolChainFactory::autoDetect(const ToolchainDetector &detecto
|
|||||||
|
|
||||||
Toolchains LinuxIccToolChainFactory::detectForImport(const ToolChainDescription &tcd) const
|
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")) ||
|
if ((tcd.language == Constants::CXX_LANGUAGE_ID && fileName.startsWith("icpc")) ||
|
||||||
(tcd.language == Constants::C_LANGUAGE_ID && fileName.startsWith("icc"))) {
|
(tcd.language == Constants::C_LANGUAGE_ID && fileName.startsWith("icc"))) {
|
||||||
return autoDetectToolChain(tcd);
|
return autoDetectToolChain(tcd);
|
||||||
|
Reference in New Issue
Block a user