forked from qt-creator/qt-creator
CMakePM: Mark CMake modules from prefix path as generated
This will result in "Project View" the "CMake Modules" folder to be hidden if it only contains CMake files from CMAKE_PREFIX_PATH or CMAKE_FIND_ROOT_PATH. Users of QtQuick or Qt Widgets applications will no longer have to see the "CMake Modules" with "<Other Locations>" and the paths to the Qt CMake files. This way the CMake projects will resmble the QMake projects. Change-Id: Icde9a556be5bceccdb4abb11072fbd17b59dce4d Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -942,6 +942,31 @@ static void setupLocationInfoForTargets(const QFuture<void> &cancelFuture,
|
||||
}
|
||||
}
|
||||
|
||||
static void markCMakeModulesFromPrefixPathAsGenerated(FileApiQtcData &result)
|
||||
{
|
||||
const QSet<FilePath> paths = [&result]() {
|
||||
QSet<FilePath> paths;
|
||||
for (const QByteArray &var : {"CMAKE_PREFIX_PATH", "CMAKE_FIND_ROOT_PATH"}) {
|
||||
const QStringList pathList = result.cache.stringValueOf(var).split(";");
|
||||
for (const QString &path : pathList)
|
||||
paths.insert(FilePath::fromString(path));
|
||||
}
|
||||
return paths;
|
||||
}();
|
||||
|
||||
if (!result.rootProjectNode)
|
||||
return;
|
||||
|
||||
result.rootProjectNode->forEachGenericNode([&paths](Node *node) {
|
||||
for (const FilePath &path : paths) {
|
||||
if (node->path().isChildOf(path)) {
|
||||
node->setIsGenerated(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// extractData:
|
||||
// --------------------------------------------------------------------
|
||||
@@ -989,6 +1014,8 @@ FileApiQtcData extractData(const QFuture<void> &cancelFuture, FileApiData &input
|
||||
if (input.replyFile.isMultiConfig && input.replyFile.generator != "Ninja Multi-Config")
|
||||
result.usesAllCapsTargets = true;
|
||||
|
||||
markCMakeModulesFromPrefixPathAsGenerated(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user