在ROS中使用`catkin build`构建时,抑制弃用警告的正确方法是什么?

huangapple go评论60阅读模式
英文:

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

问题

在构建我的ROS项目时使用catkin build,我经常会看到弃用警告弹出,我认为这些信息是无用的。这些弃用警告来自我的代码以及它的依赖项(例如:Googletest,catkin_tools_prebuild)。

我想要抑制这些弃用警告。经过一些研究,似乎我需要将CMAKE_WARN_DEPRECATED设置为False。我如何在ROS中设置这个变量?

英文:

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?

答案1

得分: 0

也许我漏掉了什么,但为什么你不能将它添加到你的CMakeLists文件中呢?就像这样,在你的CMakeLists.txt文件中添加这个标志:

set(CMAKE_WARN_DEPRECATED OFF)

catkin是建立在CMake之上的,所以它应该接受CMake标志。

英文:

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.

答案2

得分: 0

在抑制所有软件包的弃用警告方面,包括您的软件包及其依赖项,我发现最有效的方法是在执行 catkin build 之前在 catkin 配置中设置 CMAKE_WARN_DEPRECATED。在 catkin 环境中:

catkin config --cmake-args -DCMAKE_WARN_DEPRECATED=OFF
英文:

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

huangapple
  • 本文由 发表于 2023年5月29日 14:51:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/76355213.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定