CMake: Better warnings for strange/invalid CMake binaries

Warn when cmake is configured to use a non-canonical path. This might
trigger problems in CMake itself.

Show this warning in the Kit as well as in the CMake options page.

Also complain other issues in the CMake options page.

Task-number: QTCREATORBUG-22583
Change-Id: I841341db8305f9152543487ce9ceeab2eca0b2b9
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Tobias Hunger
2019-08-05 12:57:01 +02:00
parent 0b493a351e
commit de6faa0f15
4 changed files with 113 additions and 26 deletions

View File

@@ -356,6 +356,25 @@ CMakeTool::ReaderType CMakeTool::readerType() const
return m_readerType.value();
}
bool CMakeTool::isCanonicalPath(const Utils::FilePath &path)
{
const QString canonicalPath = path.toFileInfo().canonicalFilePath();
return canonicalPath == path.toString();
}
bool CMakeTool::isExecutablePathCanonical() const
{
return isCanonicalPath(cmakeExecutable());
}
QString CMakeTool::nonCanonicalPathToCMakeExecutableWarningMessage()
{
return QCoreApplication::translate(
"CMakeProjectManager::CMakeTool",
"CMake executable path is not canonical and contains \"..\", \".\" "
"or a symbolic link. This might trigger bugs in CMake.");
}
void CMakeTool::readInformation(CMakeTool::QueryType type) const
{
if ((type == QueryType::GENERATORS && !m_introspection->m_generators.isEmpty())