Skip to content

Commit 21f64c1

Browse files
committed
add options to CMakeMake.configure_step to not fail on non-zero exit code of 'cmake' command and to return full result of 'cmake' shell command
1 parent 0f5097a commit 21f64c1

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

easybuild/easyblocks/generic/cmakemake.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,15 @@ def prepend_config_opts(self, config_opts):
224224
if '-D%s=' % key not in cfg_configopts)
225225
self.cfg['configopts'] = ' '.join([new_opts, cfg_configopts])
226226

227-
def configure_step(self, srcdir=None, builddir=None):
228-
"""Configure build using cmake"""
227+
def configure_step(self, srcdir=None, builddir=None, fail_on_error=True, return_full_cmd_result=False):
228+
"""
229+
Configure build using 'cmake'
230+
231+
:param srcdir: custom source directory to use (if None, use 'srcdir' easyconfig parameter, or start dir)
232+
:param builddir: custom build directory to use (if None, 'easybuild_obj' in build directory will be used)
233+
:param fail_on_error: raise error if cmake command failed with non-zero exit code (enabled by default)
234+
:param return_full_cmd_result: return full result of running cmake command (not just the output)
235+
"""
229236

230237
setup_cmake_env(self.toolchain)
231238

@@ -263,10 +270,6 @@ def configure_step(self, srcdir=None, builddir=None):
263270
install_target = os.path.join(install_target, install_target_subdir)
264271
options = {'CMAKE_INSTALL_PREFIX': install_target}
265272

266-
if self.cmake_version >= '3.16':
267-
# Avoid some software using a lower log level than the default if this is unset
268-
options['CMAKE_MESSAGE_LOG_LEVEL'] = 'STATUS'
269-
270273
if self.installdir.startswith('/opt') or self.installdir.startswith('/usr'):
271274
# https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
272275
localstatedir = os.path.join(self.installdir, 'var')
@@ -419,9 +422,10 @@ def configure_step(self, srcdir=None, builddir=None):
419422
self.cfg.get('configure_cmd'),
420423
self.cfg['configopts']])
421424

422-
res = run_shell_cmd(command)
425+
res = run_shell_cmd(command, fail_on_error=fail_on_error)
423426
self.check_python_paths()
424-
return res.output
427+
428+
return res if return_full_cmd_result else res.output
425429

426430
def check_python_paths(self):
427431
"""Check that there are no detected Python paths outside the Python dependency provided by EasyBuild"""

0 commit comments

Comments
 (0)