Description
This affects all of your find*
modules. See CMP0074
documentation, this policy is introduced in CMake 3.12+.
Naively, the fix would just be
if (POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
I looked specifically at the FindFLANN.cmake
file, and it does appear to respect FLANN_ROOT
. Here's the relevant CMake (v3.12.1) output:
CMake Warning (dev) at CMakeLists.txt:295 (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 FLANN_ROOT is set to:
/opt/spack/opt/spack/linux-fedora27-x86_64/gcc-7.3.1/flann-1.9.1-3qqgbuypp2goiwqpdmeuoiwa2untqskm
For compatibility, CMake is ignoring the variable.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Checking for module 'flann>=1.7.0'
-- Found flann, version 1.9.1
-- Found FLANN: /opt/spack/opt/spack/linux-fedora27-x86_64/gcc-7.3.1/flann-1.9.1-3qqgbuypp2goiwqpdmeuoiwa2untqskm/lib/libflann_cpp.so (Required is at least version "1.7.0")
-- FLANN found (include: /opt/spack/opt/spack/linux-fedora27-x86_64/gcc-7.3.1/flann-1.9.1-3qqgbuypp2goiwqpdmeuoiwa2untqskm/include, lib: optimized;/opt/spack/opt/spack/linu$
-fedora27-x86_64/gcc-7.3.1/flann-1.9.1-3qqgbuypp2goiwqpdmeuoiwa2untqskm/lib/libflann_cpp.so;debug;/opt/spack/opt/spack/linux-fedora27-x86_64/gcc-7.3.1/flann-1.9.1-3qqgbuypp2
goiwqpdmeuoiwa2untqskm/lib/libflann_cpp.so)
For reference:
$ ls -R /opt/spack/opt/spack/linux-fedora27-x86_64/gcc-7.3.1/flann-1.9.1-3qqgbuypp2goiwqpdmeuoiwa2untqskm/lib/
/opt/spack/opt/spack/linux-fedora27-x86_64/gcc-7.3.1/flann-1.9.1-3qqgbuypp2goiwqpdmeuoiwa2untqskm/lib/:
libflann_cpp_s.a libflann_cpp.so@ libflann_cpp.so.1.9@ libflann_cpp.so.1.9.1* libflann_s.a libflann.so@ libflann.so.1.9@ libflann.so.1.9.1* pkgconfig/
/opt/spack/opt/spack/linux-fedora27-x86_64/gcc-7.3.1/flann-1.9.1-3qqgbuypp2goiwqpdmeuoiwa2untqskm/lib/pkgconfig:
flann.pc
I did a little snooping on Flann specifically, and that module appears to be respecting FLANN_ROOT
, but it's also worth mentioning that my flann.pc
also shows up in $PKG_CONFIG_PATH
, so while the find_{path,library}
are seemingly respecting FLANN_ROOT
, it's unclear to me if anything here actually needs to change -- pkg-config
// cmake
// find
modules are an area of CMake I'm not super comfortable with...
Other find modules are probably affected, I don't have time to check them all right now. This is a low priority issue, but the reason there is no pull request attached here is because a more thorough investigation of your vendored find modules needs to take place to actually set CMP0074
to NEW
.