如何删除 qmake 中的 alter default CFLAGS?

How to remove alter default CFLAGS in qmake?

我正在使用 qmake/make 构建库。目前,构建工作正常,但我们无法使用生成的库。

qmake 生成此 Makefile:

CFLAGS        = -Wall -pedantic -fPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -O2 $(DEFINES)
CXXFLAGS      = -Wall -pedantic -fPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -O2 $(DEFINES)

当修改 Makefile 并使用这些选项时,它起作用了:

CFLAGS        = -Wall -pedantic -fPIC
CXXFLAGS        = -Wall -pedantic -fPIC

我的 .pro 文件包含以下信息:

TEMPLATE = lib subdirs
CONFIG = create_prl staticlib
QMAKE_CXXFLAGS = -Wall -pedantic -fPIC
QMAKE_CFLAGS = -Wall -pedantic -fPIC
# and Sources + headers

问题是我如何告诉 qmake 只生成需要的标志? (即 -Wall -pedantic -fPIC

我使用这些命令成功删除了所有标志:

QMAKE_CXXFLAGS_RELEASE = -Wall -pedantic -fPIC
QMAKE_CFLAGS_RELEASE = -Wall -pedantic -fPIC