PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
9.85k stars 4.61k forks source link

CMake 3.17: The package name passed to `find_package_handle_standard_args` does not match the name of the calling package #3680

Closed SunBlack closed 3 years ago

SunBlack commented 4 years ago

I currently tested CMake 3.17(-rc1) on our build machine and currently we are getting following hints by CMake:

CMake Warning (dev) at /usr/local/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
  The package name passed to `find_package_handle_standard_args` (PCL_COMMON)
  does not match the name of the calling package (PCL).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /jenkins/workspace/myproj/install/share/pcl-1.9/PCLConfig.cmake:610 (find_package_handle_standard_args)
  CMakeLists.txt:53 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PCL_COMMON: /jenkins/workspace/myproj/install/lib/libpcl_common.so  
-- looking for PCL_KDTREE
CMake Warning (dev) at /usr/local/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
  The package name passed to `find_package_handle_standard_args` (PCL_KDTREE)
  does not match the name of the calling package (PCL).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /jenkins/workspace/myproj/install/share/pcl-1.9/PCLConfig.cmake:610 (find_package_handle_standard_args)
  CMakeLists.txt:53 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PCL_KDTREE: /jenkins/workspace/myproj/install/lib/libpcl_kdtree.so  
-- looking for PCL_SAMPLE_CONSENSUS
CMake Warning (dev) at /usr/local/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
  The package name passed to `find_package_handle_standard_args`
  (PCL_SAMPLE_CONSENSUS) does not match the name of the calling package
  (PCL).  This can lead to problems in calling code that expects
  `find_package` result variables (e.g., `_FOUND`) to follow a certain
  pattern.
Call Stack (most recent call first):
  /jenkins/workspace/myproj/install/share/pcl-1.9/PCLConfig.cmake:610 (find_package_handle_standard_args)
  CMakeLists.txt:53 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

Maybe it helps to pass a max (3.16) version to cmake_minimum_required to fix it until we have time to really improve it. But currently I don't have time to test it.

stale[bot] commented 4 years ago

Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.

kunaltyagi commented 4 years ago

I think the issue is resolved in master. I'm using 3.17.2 and can't reproduce it

I was wrong

SergioRAgostinho commented 4 years ago

FYI: I remember also getting these warnings recently.

amitrjaiswal1 commented 4 years ago

Still error exists. Anyone has solution for this ?

SergioRAgostinho commented 4 years ago

I believe the fix has been merged already. @larshg was it?

larshg commented 4 years ago

Not the fix I implemented. Mine was about Ensenso, LibUSB and one more I think.

This seems to be a warning when using PCL modules in downstream projects instead.

mrgransky commented 4 years ago

I got the same warning compiling a package, cartographer_ros, in catkin_ws in ROS running: $ catkin build for both PCL_COMMON and eigen!

sebastian-freitag commented 3 years ago

This is what I did to temporarily solve this issue and keep build output minimal and relevant:

CMakeLists.txt in my project:

(...)
# see here: https://github.com/PointCloudLibrary/pcl/issues/3680
# when this is fixed, we can remove the following 3 lines.
if(NOT DEFINED CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
     set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
endif()

find_package(PCL REQUIRED)

(...)
nccurry commented 3 years ago

Seeing the same for rt:

CMake Warning (dev) at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
  The package name passed to `find_package_handle_standard_args` (rt) does
  not match the name of the calling package (RT).  This can lead to problems
  in calling code that expects `find_package` result variables (e.g.,
  `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  Glitter/Vendor/assimp/cmake-modules/FindRT.cmake:19 (find_package_handle_standard_args)
  Glitter/Vendor/assimp/code/CMakeLists.txt:1037 (FIND_PACKAGE)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Enabled importer formats: AMF 3DS AC ASE ASSBIN B3D BVH COLLADA DXF CSM HMP IRRMESH IRR LWO LWS M3D MD2 MD3 MD5 MDC MDL NFF NDO OFF OBJ OGRE OPENGEX PLY MS3D COB BLEND IFC XGL FBX Q3D Q3BSP RAW SIB SMD STL TERRAGEN 3D X X3D GLTF 3MF MMD
-- Disabled importer formats:
-- Enabled exporter formats: OBJ OPENGEX PLY 3DS ASSBIN ASSXML M3D COLLADA FBX STL X X3D GLTF 3MF ASSJSON STEP
-- Disabled exporter formats:
mvieth commented 3 years ago

@nccurry Your warning seems to come from a different project, not PCL. It appears you are compiling/using assimp? I suggest you open an issue there.

According to this cmake documentation (see note), the warning can be disabled by setting FPHSA_NAME_MISMATCHED. I think it is ok to do that because the function find_package_handle_standard_args is later also called for PCL, not only for the modules, so PCL_FOUND will be set.

jackjansen commented 3 years ago

I'm running into the same problem (using PCL as a dependency in my project), and I'm reluctant to apply the workarounds suggested here in my CMakefiles, because it will also silence other instances of the warning that could actually be useful.

Could this issue somehow be fixed in the PCL CMakefiles (or probably find_package) and reset to the previous value afterwards?

CherrryJ commented 3 years ago

So……is there has any solution???

kunaltyagi commented 3 years ago

4431 has been merged. For now, please see if you can apply that as a patch. Else use master branch till PCL 1.12 is released