CMakeProjectManager: Use canonical paths for compiler match import

On Linux (Ubuntu 20.04) Qt Creator would use /usr/bin/g++ as
compiler for C++. CMake would pick /usr/bin/c++ as C++ compiler.
Both of them are symlinks to /usr/bin/x86_64-linux-gnu-g++-9

There is no need to create imported kits for something which
is the same compiler.

Fixes: QTCREATORBUG-25069
Change-Id: I90e0f7b1977ace3f7995ce09f4b3fcfa64d02b72
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Cristian Adam
2020-12-11 16:41:46 +01:00
parent 20a3eae86f
commit 4ae5516453

View File

@@ -324,7 +324,7 @@ bool CMakeProjectImporter::matchKit(void *directoryData, const Kit *k) const
if (!Utils::contains(allLanguages, [&tcd](const Id& language) {return language == tcd.language;}))
continue;
ToolChain *tc = ToolChainKitAspect::toolChain(k, tcd.language);
if (!tc || tc->compilerCommand() != tcd.compilerPath)
if (!tc || tc->compilerCommand().canonicalPath() != tcd.compilerPath.canonicalPath())
return false;
}