diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-08-05 12:57:01 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-08-05 15:13:40 +0000 |
commit | de6faa0f15b265d4b6c85135a2c28c881971b46b (patch) | |
tree | bace38fecaf5730d7bbe44f0e9edd3993003f513 /src/plugins/cmakeprojectmanager/cmaketool.cpp | |
parent | 0b493a351e13e31b16bf2dd5b3beceadcb9ddd27 (diff) |
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>
Diffstat (limited to 'src/plugins/cmakeprojectmanager/cmaketool.cpp')
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmaketool.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmaketool.cpp b/src/plugins/cmakeprojectmanager/cmaketool.cpp index f37939174ac..695ae5c483e 100644 --- a/src/plugins/cmakeprojectmanager/cmaketool.cpp +++ b/src/plugins/cmakeprojectmanager/cmaketool.cpp @@ -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()) |