Skip to content
7 changes: 6 additions & 1 deletion easybuild/easyblocks/c/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this more readable:

Suggested change
if LooseVersion(cmake_version) >= LooseVersion('3.15'):
if LooseVersion(cmake_version) >= '3.15':

But just a suggestion

add_cmake_opts['MAKE_POLICY_DEFAULT_CMP0094'] = 'NEW'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
add_cmake_opts['MAKE_POLICY_DEFAULT_CMP0094'] = 'NEW'
add_cmake_opts['CMAKE_POLICY_DEFAULT_CMP0094'] = 'NEW'

https://cmake.org/cmake/help/latest/variable/CMAKE_POLICY_DEFAULT_CMPNNNN.html


cmake_prefix_path = os.environ.get('CMAKE_PREFIX_PATH', '').split(':')
cmake_library_path = os.environ.get('CMAKE_LIBRARY_PATH', '').split(':')
Expand Down