From 9df06af9bdae6d4e7daf82c53992099d3dd61f92 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 18 Aug 2020 13:21:58 +0200 Subject: [PATCH] CMake: Fix comparison of source paths when importing We need to check canonical paths with canonical paths. Otherwise we get a mismatch when using e.g. a linked directory for the source path on the command line and then try to import the build in Qt Creator. Change-Id: I153be74b6cfdf5070e023780604ce64c92df0e6d Reviewed-by: Cristian Adam --- src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp index de40ecbd2de..7a3c29d68c3 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp @@ -245,8 +245,10 @@ QList CMakeProjectImporter::examineDirectory(const Utils::FilePath &impo qCDebug(cmInputLog) << "Failed to read configuration from" << cacheFile << errorMessage; return { }; } - const auto homeDir - = Utils::FilePath::fromUserInput(QString::fromUtf8(CMakeConfigItem::valueOf("CMAKE_HOME_DIRECTORY", config))); + const auto homeDir = Utils::FilePath::fromUserInput( + QString::fromUtf8( + CMakeConfigItem::valueOf("CMAKE_HOME_DIRECTORY", config))) + .canonicalPath(); const Utils::FilePath canonicalProjectDirectory = projectDirectory().canonicalPath(); if (homeDir != canonicalProjectDirectory) { qCDebug(cmInputLog) << "Wrong source directory:" << homeDir.toUserOutput()