Qmake:如何在不更改 qmake.conf 的情况下删除某个项目的编译器标志?

2021-12-09 00:00:00 qt c++ qmake compiler-options

我正在使用 qmake 和 Visual Studio.在发布版本中,qmake 向所有项目添加了/GL 和/O2 标志,我需要为整个 Qt 项目中的某些库删除这两个标志.有办法吗?

I'm using qmake and Visual Studio. In release build qmake adds /GL and /O2 flags to all projects, and I need to remove those two flags for certain libraries within my whole Qt project. Is there a way?

推荐答案

唯一可行的方法是

QMAKE_CFLAGS -= /GL /O2

但我怀疑这是否适用于 QMAKE_CFLAGS.

but I doubt this works for QMAKE_CFLAGS.

或者,你可以重新定义 QMAKE_CFLAGS,忘记它之前的值:

Alternatively, you could redefine QMAKE_CFLAGS, forgetting its previous value:

QMAKE_CFLAGS = $$CFLAGS_WITHOUT_GL_O2

相关文章