diff --git a/easybuild/easyblocks/generic/cmakemake.py b/easybuild/easyblocks/generic/cmakemake.py index 5953650df75..f8aeba18fd7 100644 --- a/easybuild/easyblocks/generic/cmakemake.py +++ b/easybuild/easyblocks/generic/cmakemake.py @@ -51,6 +51,7 @@ def extra_options(extra_vars=None): extra_vars.update({ 'srcdir': [None, "Source directory location to provide to cmake command", CUSTOM], 'separate_build_dir': [False, "Perform build in a separate directory", CUSTOM], + 'create_installdir_before_configure': [False, "Create or clean the install directory prior to running cmake", CUSTOM], }) return extra_vars @@ -60,6 +61,11 @@ def configure_step(self, srcdir=None, builddir=None): if builddir is not None: self.log.nosupport("CMakeMake.configure_step: named argument 'builddir' (should be 'srcdir')", "2.0") + if self.cfg['create_installdir_before_configure']: + self.log.info("Cleaning and creating the install directory. Setting keeppreviousinstall to True.") + self.make_installdir() + self.cfg['keeppreviousinstall'] = True + # Set the search paths for CMake include_paths = os.pathsep.join(self.toolchain.get_variable("CPPFLAGS", list)) library_paths = os.pathsep.join(self.toolchain.get_variable("LDFLAGS", list))