Utils: Make FilePath::refersToExe(...) return the found item

... and use in on the CMake side.

Change-Id: Ib215ebc4f87beb67b6a302d0c42e7b955a2fa5b7
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
hjk
2022-11-28 11:43:18 +01:00
parent 9e0ed9eeac
commit a146403596
5 changed files with 26 additions and 20 deletions

View File

@@ -70,8 +70,8 @@ static std::vector<std::unique_ptr<CMakeTool>> autoDetectCMakeTools()
if (base.isEmpty())
continue;
const FilePath suspect = base / "cmake";
if (suspect.refersToExecutableFile(FilePath::WithAnySuffix))
suspects << suspect;
if (std::optional<FilePath> foundExe = suspect.refersToExecutableFile(FilePath::WithAnySuffix))
suspects << *foundExe;
}
std::vector<std::unique_ptr<CMakeTool>> found;