diff --git a/easybuild/easyblocks/c/cmake.py b/easybuild/easyblocks/c/cmake.py index 42dadd996c..924139f50c 100644 --- a/easybuild/easyblocks/c/cmake.py +++ b/easybuild/easyblocks/c/cmake.py @@ -32,9 +32,10 @@ from easybuild.tools.build_log import EasyBuildError from easybuild.tools.config import build_option from easybuild.tools.filetools import apply_regex_substitutions -from easybuild.tools.modules import get_software_root, get_software_libdir +from easybuild.tools.modules import get_software_root, get_software_libdir, get_software_version import easybuild.tools.environment as env from easybuild.tools.filetools import symlink +from easybuild.tools import LooseVersion class EB_CMake(ConfigureMake): @@ -99,6 +100,10 @@ def configure_step(self): add_cmake_opts = {} if self.cfg['use_openssl']: add_cmake_opts['CMAKE_USE_OPENSSL'] = 'ON' + # Use CMP0094 policy for python resolution. This is only available for CMake versions newer than 3.15 included + cmake_version = get_software_version('CMake') + if LooseVersion(cmake_version) >= LooseVersion('3.15'): + add_cmake_opts['MAKE_POLICY_DEFAULT_CMP0094'] = 'NEW' cmake_prefix_path = os.environ.get('CMAKE_PREFIX_PATH', '').split(':') cmake_library_path = os.environ.get('CMAKE_LIBRARY_PATH', '').split(':')