From afc01f95704a9fd06398222fc5f8d5416af1afb4 Mon Sep 17 00:00:00 2001 From: psakievich Date: Thu, 10 Oct 2024 00:45:10 -0600 Subject: CMake: Improve incremental build speed. (#46878) * CMake: Improve incremental build speed. CMake automatically embeds an updated configure step into make/ninja that will be called during the build phase. By default if a `CMakeCache.txt` file exists in the build directory CMake will use it and this + `spec.is_develop` is sufficient evidence of an incremental build. This PR removes duplicate work/expense from CMake packages when using `spack develop`. * Update cmake.py * [@spackbot] updating style on behalf of psakievich * Update cmake.py meant self not spec... --------- Co-authored-by: psakievich --- lib/spack/spack/build_systems/cmake.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/spack/spack/build_systems/cmake.py b/lib/spack/spack/build_systems/cmake.py index 93d3485ae0..7752c473f6 100644 --- a/lib/spack/spack/build_systems/cmake.py +++ b/lib/spack/spack/build_systems/cmake.py @@ -541,6 +541,13 @@ class CMakeBuilder(BaseBuilder): def cmake(self, pkg, spec, prefix): """Runs ``cmake`` in the build directory""" + + # skip cmake phase if it is an incremental develop build + if spec.is_develop and os.path.isfile( + os.path.join(self.build_directory, "CMakeCache.txt") + ): + return + options = self.std_cmake_args options += self.cmake_args() options.append(os.path.abspath(self.root_cmakelists_dir)) -- cgit v1.2.3-70-g09d2