在 Qt Creator 中,我在哪里将参数传递给编译器?

2021-12-09 00:00:00 qt qt-creator c++

在 Qt Creator 中,我在哪里将参数传递给编译器?
这不是那么明显.

Where in Qt Creator do I pass arguments to a compiler?
It isn't really that obvious.

推荐答案

根据您的构建系统,它位于您的 qmake 项目文件(.pro,新项目的标准)或 CMake 文件(CMakeLists.txt,由 KDE 和其他几个项目使用).

Depending on your build system it's either in your qmake project file(.pro, standard for new projects) or in one of the CMake files (CMakeLists.txt, used by KDE and several other projects).

使用 .pro:

QMAKE_CXXFLAGS += -O2

使用 CMake:

set( CMAKE_CXX_FLAGS "-g -Wall")

相关文章