From cfe187f5cc964a12c6836484f32597e97e55a93e Mon Sep 17 00:00:00 2001 From: Stephanie Gawroriski Date: Mon, 8 Apr 2024 17:19:49 +0000 Subject: [PATCH] Look for CMake in homebrew. --- .../cc/squirreljme/plugin/general/cmake/CMakeUtils.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/java/cc/squirreljme/plugin/general/cmake/CMakeUtils.java b/buildSrc/src/main/java/cc/squirreljme/plugin/general/cmake/CMakeUtils.java index a092f44997..7622724cca 100644 --- a/buildSrc/src/main/java/cc/squirreljme/plugin/general/cmake/CMakeUtils.java +++ b/buildSrc/src/main/java/cc/squirreljme/plugin/general/cmake/CMakeUtils.java @@ -67,7 +67,8 @@ public final class CMakeUtils cmakePath = PathUtils.findPath("cmake.exe"); // Standard installation on Windows? - if (OperatingSystem.current() == OperatingSystem.WINDOWS) + if (cmakePath == null && + OperatingSystem.current() == OperatingSystem.WINDOWS) { String programFiles = System.getenv("PROGRAMFILES"); if (programFiles != null) @@ -75,10 +76,21 @@ public final class CMakeUtils Path maybe = Paths.get(programFiles).resolve("CMake") .resolve("bin").resolve("cmake.exe"); if (Files.exists(maybe)) - return maybe; + cmakePath = maybe; } } + // Homebrew on macOS? + if (cmakePath == null && + OperatingSystem.current() == OperatingSystem.MAC_OS) + { + Path maybe = Paths.get("/").resolve("opt") + .resolve("homebrew").resolve("bin") + .resolve("cmake"); + if (Files.exists(maybe)) + cmakePath = maybe; + } + return cmakePath; } -- 2.11.4.GIT