What is the correct way to suppress deprecation warnings when building with `catkin build` in ROS?

441 Views Asked by At

During building my ROS project using catkin build, I often times see deprecation warnings popping up which I deem useless information. This deprecation warnings are coming from my code and also it's dependencies (eg:Googletest, catkin_tools_prebuild)

I would like to suppress these deprecation warnings. After doing some research, it seems like I have to set CMAKE_WARN_DEPRECATED to False. How do I set this variable in ROS?

2

There are 2 best solutions below

0
Scotrraaj Gopal On BEST ANSWER

What I found to work best in suppressing the deprecation warnings of all packages, including yours and it's dependencies, is to set the CMAKE_WARN_DEPRECATED in catkin config before doing catkin build.

In the catkin environment:

catkin config --cmake-args -DCMAKE_WARN_DEPRECATED=OFF
1
Sri On

Maybe I'm missing something, but why can't you add it to your CMAKELists file? As in, add this flag to your CMakeLists.txt file:

set(CMAKE_WARN_DEPRECATED OFF)

catkin is built on top of CMake so it should accept cmake flags.