From 91d006db1f641590e56edde37f2451177028bedb Mon Sep 17 00:00:00 2001 From: Ward Poelmans Date: Thu, 4 Feb 2016 15:33:13 +0100 Subject: [PATCH] Add option to create the install dir prior to configure in CMakeMake If CMake uses external project that also must be installed in the final install dir, it cannot be cleaned between the build and install step. With the `create_installdir_before_configure` option set to True, the install dir will be cleaned and create prior to running cmake. `keeppreviousinstall` is set to True so that it doesn't get cleaned again. --- easybuild/easyblocks/generic/cmakemake.py | 6 ++++++ 1 file changed, 6 insertions(+) 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))