Skip to content

Commit a9a04dd

Browse files
authored
Merge pull request #2032 from Flamefire/clean_build_dir
let CMakeMake remove 'easybuild_obj' build directory if it already exists
2 parents db913b4 + c5b6743 commit a9a04dd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

easybuild/easyblocks/generic/cmakemake.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
from easybuild.framework.easyconfig import CUSTOM
4040
from easybuild.tools.build_log import print_warning
4141
from easybuild.tools.config import build_option
42-
from easybuild.tools.filetools import change_dir, mkdir, which
42+
from easybuild.tools.filetools import change_dir, mkdir, which, remove_dir
4343
from easybuild.tools.environment import setvar
4444
from easybuild.tools.modules import get_software_root
4545
from easybuild.tools.run import run_cmd
@@ -120,6 +120,12 @@ def configure_step(self, srcdir=None, builddir=None):
120120

121121
if builddir is None and self.cfg.get('separate_build_dir', True):
122122
builddir = os.path.join(self.builddir, 'easybuild_obj')
123+
# For separate_build_dir we want a clean folder. So remove if it exists
124+
# This can happen when multiple iterations are done (e.g. shared, static, ...)
125+
if os.path.exists(builddir):
126+
self.log.warning('Build directory %s already exists (from previous iterations?). Removing...',
127+
builddir)
128+
remove_dir(builddir)
123129

124130
if builddir:
125131
mkdir(builddir, parents=True)

0 commit comments

Comments
 (0)