Qt Creator:在.pro中添加自定义构建配置设置

时间:2015-04-21 12:58:12

标签: c++ qt build qt-creator

我正在尝试为自定义构建配置添加构建设置。

默认情况下,Qt Creator会创建debugrelease个配置(http://doc.qt.digia.com/qtcreator-2.4/creator-build-settings.html)。

对于这些配置,您可以添加自定义构建设置。例如:

release: DESTDIR = $${build_root_dir}/release
debug:   DESTDIR = $${build_root_dir}/debug

我在Qt Creator中创建了另一个名为debug_menu_active的构建配置。 我想使用相同的陈述:

debug_menu_active: DEFINES += FORCE_ACTIVE_MENU_DEBUG
debug_menu_active: DESTDIR = $${build_root_dir}/debug_menu_active

不幸的是,它不起作用message("DEFINES: "$${DEFINES})给出:

Project MESSAGE: DEFINES :UNICODE QT_LARGEFILE_SUPPORT

我想我需要定义其他内容,但我不知道它可能是什么。

有人可以帮我这个吗?

谢谢!

更新

我测试了@svlasov的答案,但不幸的是它打破了编译:

qtinternal\moc\moc_scenario.cpp:10:154: error: scenario.h: No such file or directory
qtinternal\moc\moc_scenario.cpp:12:2: error: #error "The header file 'scenario.h' doesn't include <QObject>."
qtinternal\moc\moc_scenario.cpp:20: error: expected constructor, destructor, or type conversion before 'static'
qtinternal\moc\moc_scenario.cpp:48: error: 'scenario' has not been declared
qtinternal\moc\moc_scenario.cpp:48: error: variable or field 'qt_static_metacall' declared void
qtinternal\moc\moc_scenario.cpp:48: error: 'QObject' was not declared in this scope
qtinternal\moc\moc_scenario.cpp:48: error: '_o' was not declared in this scope
qtinternal\moc\moc_scenario.cpp:48: error: 'QMetaObject' has not been declared
qtinternal\moc\moc_scenario.cpp:48: error: expected primary-expression before 'int'
qtinternal\moc\moc_scenario.cpp:48: error: expected primary-expression before 'void'

我是这样做的: enter image description here

1 个答案:

答案 0 :(得分:4)

Build Steps下,qmake步骤设置Additional arguments为:

CONFIG+=debug_menu_active