Fix upper-case package root CMake warning

CMake 3.27 introduced the new policy CMP0144 which makes it so the
find_Package() functions use the upper-case <package>_ROOT variable
when set. It is off by default, but it does check for the possible
interference and warns about it. The warning happens when the upper
case package root variable is set, and a find_package() is called
with a lower case package name.

In practice this leads to issue with CMake on macOS where the
TIFF_ROOT is set to an expected variable, and find_package is used
to find TIFF. THe CMake's FindTIFF.cmake attempts to find CMake
configuration of the tiff library using find_package(tiff CONFIG)
which triggers the policy warning.

This change makes it so the policy is set to NEW, silencing the
warning and bringing us to a more desired/expected behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/119120
This commit is contained in:
Sergey Sharybin
2024-03-06 16:51:06 +01:00
committed by Sergey Sharybin
parent 445fd42c61
commit c63b36e6b2

View File

@@ -84,6 +84,11 @@ if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
# find_package() uses uppercase <PackageName>_ROOT variables.
if(POLICY CMP0144)
cmake_policy(SET CMP0144 NEW)
endif()
# Install CODE|SCRIPT allow the use of generator expressions.
if(POLICY CMP0087)
cmake_policy(SET CMP0087 NEW)