From 12ee28f0903aec5b6c1519daacadcad228db782b Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 22 Jan 2020 14:40:57 +0100 Subject: [PATCH] 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 --- src/plugins/cmakeprojectmanager/cmaketool.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/cmaketool.cpp b/src/plugins/cmakeprojectmanager/cmaketool.cpp index 4efc3515295..52f6f678932 100644 --- a/src/plugins/cmakeprojectmanager/cmaketool.cpp +++ b/src/plugins/cmakeprojectmanager/cmaketool.cpp @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -268,7 +269,13 @@ Utils::FilePath CMakeTool::cmakeExecutable(const Utils::FilePath &path) 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