diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 51ee3d7d8b..ceb1a499a5 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -1497,8 +1497,21 @@ def make_executable(path): os.chmod(path, mode) + class CMakePackage(StagedPackage): + def make_make(self): + import multiprocessing + # number of jobs spack will to build with. + jobs = multiprocessing.cpu_count() + if not self.parallel: + jobs = 1 + elif self.make_jobs: + jobs = self.make_jobs + + make = spack.build_environment.MakeExecutable('make', jobs) + return make + def configure_args(self): """Returns package-specific arguments to be provided to the configure command.""" return list() @@ -1576,10 +1589,12 @@ def install_configure(self): cmake(self.source_directory, *options) def install_build(self): + make = self.make_make() with working_dir(self.build_directory, create=False): make() def install_install(self): + make = self.make_make() with working_dir(self.build_directory, create=False): make('install')