CMake: Fix snap-ed CMake installations on ubuntu

Snap packages apparently work by sym-linking the cmake binary to snap.

So keep the sym-link if it points to a file called "snap" on Linux.

Task-number: QTCREATORBUG-23376
Change-Id: I065457c26b32a191760e8dda1ef1bdc7a79712ad
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Tobias Hunger
2020-01-22 14:40:57 +01:00
parent 2da7d205d4
commit 12ee28f090

View File

@@ -28,6 +28,7 @@
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QDir> #include <QDir>
@@ -268,7 +269,13 @@ Utils::FilePath CMakeTool::cmakeExecutable(const Utils::FilePath &path)
return toTest.canonicalPath(); return toTest.canonicalPath();
} }
} }
return path.canonicalPath();
const Utils::FilePath resolvedPath = path.canonicalPath();
// Evil hack to make snap-packages of CMake work. See QTCREATORBUG-23376
if (Utils::HostOsInfo::isLinuxHost() && resolvedPath.fileName() == "snap")
return path;
return resolvedPath;
} }
bool CMakeTool::isAutoRun() const bool CMakeTool::isAutoRun() const