Qt Creator:在 .pro 中添加自定义构建配置设置
Qt Creator: add custom build configuration settings in .pro
我正在尝试为自定义构建配置添加构建设置。
默认情况下,Qt Creator 创建 debug
和 release
配置 (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'
这是我的做法:
在 Build Steps
下,对于 qmake
步骤,将 Additional arguments
设置为:
CONFIG+=debug_menu_active
我正在尝试为自定义构建配置添加构建设置。
默认情况下,Qt Creator 创建 debug
和 release
配置 (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'
这是我的做法:
在 Build Steps
下,对于 qmake
步骤,将 Additional arguments
设置为:
CONFIG+=debug_menu_active