Would like to disable cmake dev warning

My cmake script searches for Perl libs, but I get the following warning message:

CMake Warning (dev) at cmake-install/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
  The package name passed to `find_package_handle_standard_args` (Perl) does
  not match the name of the calling package (PerlLibs).  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):
  cmake-install/share/cmake-3.17/Modules/FindPerl.cmake:76 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  cmake-install/share/cmake-3.17/Modules/FindPerlLibs.cmake:48 (include)
  CMakeLists.txt:208 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

How can I disable this? Not sure where I need to put -Wno-dev

You can disable the warning like this when you are configuring your build.

-Wno-dev

Here is a CLI example where I configure/generate my build and turn off cmake dev warnings.

cmake -S . -B build -Wno-dev

However, when it comes to just silencing warnings. It’s better to just fix the actual problem. Build code needs to maintained and fixed just like any other code.

Silencing warnings permanently is just asking for problems down the road.

Thanks, @anon45792294 ! How can I silence the warning if this is happening inside the cmake find_package code for PerlLibs ?

Depends.

  • It could be user error: You could be using find_package incorrectly. Or your cmake code could just be wrong.
  • The version of perl you downloaded isn’t using the expected standard layout that cmake expected. I had this happen when someone mangled python at my company in a bizzare way…
  • The official cmake support for perl could be wrong (unlikely, but possible).

Whatever the case is. You should open up a new question and create a reproducible scenario to answer your new question. Otherwise it’s a painful guessing game.

Thanks. this issue happens on my CI. The CI runs on windows, osx and ubuntu, but the warning only appears on ubuntu. So, it may be a configuration issue. Or it may be related to the cmake version on Ubuntu (3.17). I am happy to simply suppress with -Wno-dev