pcl icon indicating copy to clipboard operation
pcl copied to clipboard

[CMAKE] FLANN_ROOT is used with cmake versions >=3.27 but CMP0144 is set to old

Open wodtko opened this issue 7 months ago • 1 comments

currently, the cmake policy CMP0144 is implicitly set to old, in this.

If I understand things correctly, prior to CMP0144 upper-case <PACKAGENAME>_ROOT variables have been ignored. Now, using CMP0144 NEW, would actually use these variables.

However, in the current configuration, the variable FLANN_ROOT is set, but the policy is set to OLD which results in a cmake warning that I do not manage to suppress from outside PCL. The warning states:

CMake Warning (dev) at /usr/lib/x86_64-linux-gnu/cmake/pcl/Modules/FindFLANN.cmake:45 (find_package):
  Policy CMP0144 is not set: find_package uses upper-case <PACKAGENAME>_ROOT
  variables.  Run "cmake --help-policy CMP0144" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  CMake variable FLANN_ROOT is set to:

    /usr

  For compatibility, find_package is ignoring the variable, but code in a
  .cmake module might still use it.
Call Stack (most recent call first):
  /usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:261 (find_package)
  /usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:306 (find_flann)
  /usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake:570 (find_external_library)
  [... calling find_package(PCL) in our own config ...]
This warning is for project developers.  Use -Wno-dev to suppress it.

I'm not entirely sure why the issue is raised in the first place since cmake states here that the <PACKAGENAME>_ROOT variables are only ignored IF the <PackageName> has lower-case variables. But I cannot find a way of suppressing the variable due to the line referenced above, where all policies are explicitly set, no matter what was previously configured. Perhaps the CMP0144 policy can be set to NEW explicitly if the CMake version >=3.27.

wodtko avatar Jul 24 '24 15:07 wodtko