Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions easybuild/easyblocks/generic/cmakemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,23 @@ def configure_step(self, srcdir=None, builddir=None):
options['BOOST_ROOT'] = boost_root
options['Boost_NO_SYSTEM_PATHS'] = 'ON'

# Make sure CMake finds our Python when it is a direct or indirect dependency
python_root = get_software_root('Python')
if python_root:
# CMake 3.12 introduced FindPython/FindPython2/FindPython3
# Below only FindPythonInterp existed in core CMake which don't has such hints.
# However PYTHON_EXECUTABLE could be used.
if LooseVersion(self.cmake_version) >= '3.12':
python_version = LooseVersion(get_software_version('Python'))
# For find_package(Python)
options['Python_ROOT_DIR'] = python_root
if python_version >= '3':
# For find_package(Python3)
options['Python3_ROOT_DIR'] = python_root
else:
# For find_package(Python2)
options['Python2_ROOT_DIR'] = python_root

if self.cfg.get('configure_cmd') == DEFAULT_CONFIGURE_CMD:
self.prepend_config_opts(options)
command = ' '.join([
Expand Down