From aca3df7c868d61598bd39e9384e7385407d97231 Mon Sep 17 00:00:00 2001 From: crivella Date: Mon, 30 Sep 2024 15:43:41 +0200 Subject: [PATCH] Generalized to `Python_EXECUTABLE` --- easybuild/easyblocks/generic/cmakemake.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/easybuild/easyblocks/generic/cmakemake.py b/easybuild/easyblocks/generic/cmakemake.py index 98cd44f258..85f7cc9215 100644 --- a/easybuild/easyblocks/generic/cmakemake.py +++ b/easybuild/easyblocks/generic/cmakemake.py @@ -284,9 +284,18 @@ def configure_step(self, srcdir=None, builddir=None): # disable CMake user package repository options['CMAKE_FIND_USE_PACKAGE_REGISTRY'] = 'OFF' - # ensure CMake uses PATH to determine python without prioritizing a virtualenv - # necessary to pick up on the correct python version when `eb` is run from a virtualenv - options['Python3_FIND_VIRTUALENV'] = 'STANDARD' + # ensure CMake uses EB python, not system or virtualenv python + python_root = get_software_root('Python') + if python_root: + python_version = LooseVersion(get_software_version('Python')) + python_exe = os.path.join(python_root, 'bin', 'python') + options['Python_EXECUTABLE'] = python_exe + # This is needed if someone is still using `find_package(PythonInterp ...)` in their CMakeLists.txt + options['PYTHON_EXECUTABLE'] = python_exe + if python_version >= "3": + options['Python3_EXECUTABLE'] = python_exe + else: + options['Python2_EXECUTABLE'] = python_exe if not self.cfg.get('allow_system_boost', False): boost_root = get_software_root('Boost')