作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 ROS,因此编写 CMake 文件。在 Qt .pro
文件中,我们可以使用:
DEFINE+=QT_NO_DEBUG_OUTPUT
我们如何在 CMake 文件中做到这一点?我试过:
add_definitions(QT_NO_DEBUG_OUTPUT)
但它给了我以下错误:
c++: error: QT_NO_DEBUG_OUTPUT: No such file or directory
最佳答案
add_definitions
要求您根据编译器语法编写标志:在您的情况下使用 -D
(在视觉上将是 /D
)。你应该只写:
add_definitions(-DQT_NO_DEBUG_OUTPUT)
一种更灵活、更细粒度的方法是使用 target_compile_definitions
为每个目标添加定义。 :
add_executable(foo ...)
target_compile_definitions(foo PUBLIC QT_DEBUG_NO_OUTPUT)
注意这里不需要-D
。
关于c++ - 如何在 CMake 文件中添加定义 QT_NO_DEBUG_OUTPUT?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49333056/
我是一名优秀的程序员,十分优秀!