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 <psakievich@users.noreply.github.com>
This commit is contained in:
psakievich 2024-10-10 00:45:10 -06:00 committed by GitHub
parent fc3a484a8c
commit afc01f9570
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -541,6 +541,13 @@ def cmake_args(self):
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))