Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cmake version requirement to fix warnings that _ROOT variables are ignored #610

Closed
climbfuji opened this issue Nov 9, 2024 · 0 comments · Fixed by #611
Closed
Assignees

Comments

@climbfuji
Copy link
Collaborator

climbfuji commented Nov 9, 2024

Description

@DusanJovic-NOAA reported this:

When building ufs on Hera (with gnu) I see this ccpp (framework and physics) cmake warnings:

CMake Warning (dev) at FV3/ccpp/framework/CMakeLists.txt:15 (find_package):
 Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
 Run "cmake --help-policy CMP0074" for policy details.  Use the cmake_policy
 command to set the policy and suppress this warning.

 Environment variable MPI_ROOT is set to:

   /scratch2/NCEPDEV/stmp1/role.epic/installs/openmpi/4.1.6_gnu13.3

 For compatibility, CMake is ignoring the variable.
This warning is for project developers.  Use -Wno-dev to suppress it.

This is the description about CMP0074 policy:

$ cmake --help-policy CMP0074
CMP0074
-------

.. versionadded:: 3.12

``find_package()`` uses ``<PackageName>_ROOT`` variables.

In CMake 3.12 and above the ``find_package(<PackageName>)`` command now
searches prefixes specified by the ``<PackageName>_ROOT`` CMake
variable and the ``<PackageName>_ROOT`` environment variable.
Package roots are maintained as a stack so nested calls to all ``find_*``
commands inside find modules and config packages also search the roots as
prefixes.  This policy provides compatibility with projects that have not been
updated to avoid using ``<PackageName>_ROOT`` variables for other purposes.

The ``OLD`` behavior for this policy is to ignore ``<PackageName>_ROOT``
variables.  The ``NEW`` behavior for this policy is to use
``<PackageName>_ROOT`` variables.

This policy was introduced in CMake version 3.12.  CMake version
3.23.1 warns when the policy is not set and uses ``OLD`` behavior.
Use the ``cmake_policy()`` command to set it to ``OLD`` or ``NEW``
explicitly.

.. note::
 The ``OLD`` behavior of a policy is
 ``deprecated by definition``
 and may be removed in a future version of CMake.

In both framework and physics the minimum cmake version is set to be 3.10. That means, for compatibility with older cmake versions, *_ROOT variables are ignored. To silence this warning we need to either set the policy to NEW or update minimum cmake version to >= 3.12

Solution

Current cmake versions used on the tier-1 platforms are somewhere around 3.20 (provided by the operating system or as default modules) or closer to 3.30 (spack-stack built). We can therefore safely increase the minimum version required to 3.18, for example.

Alternatives (optional)

Do nothing - no good.

Related to (optional)

NCAR/ccpp-physics#1100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant