From 2e9e12a8bdf79491dd3fce72c97b8f68a32f42ed Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Fri, 9 May 2025 15:59:05 +0100 Subject: [PATCH] [6.2] Build CMake on macOS if one is not preinstalled We build CMake on all platforms (except Darwin for an unknown reason) if CMake is not preinstalled. Since CMake 4.0 regresses certain build configurations, there's currently no way to build on Darwin without installing an older CMake version 3.x manually. This can be simplified if we build a pinned version of CMake consistently on all platforms. Addresses rdar://159939866 (cherry picked from commit 7db6c5ddaa9f41f57e5be0adaf9f38e98cded238) --- utils/swift_build_support/swift_build_support/cmake.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/utils/swift_build_support/swift_build_support/cmake.py b/utils/swift_build_support/swift_build_support/cmake.py index 8cafcf5353b64..bfb6996589022 100644 --- a/utils/swift_build_support/swift_build_support/cmake.py +++ b/utils/swift_build_support/swift_build_support/cmake.py @@ -282,14 +282,9 @@ def build_cmake(self, source_root, build_root): os.chdir(cwd) return os.path.join(cmake_build_dir, 'bin', 'cmake') - # Get the path to CMake to use for the build - # This function will not build CMake for Apple platforms. - # For other platforms, this builds CMake if a new enough version is not - # available. + # Get the path to CMake to use for the build, this builds CMake if a new enough + # version is not available. def get_cmake_path(self, source_root, build_root): - if platform.system() == 'Darwin': - return self.toolchain.cmake - cmake_source_dir = os.path.join(source_root, 'cmake') if not os.path.isdir(cmake_source_dir): return self.toolchain.cmake