[英]How to reuse properties of a Qbs project?
How two projects, a CppApplication and a DynamicLibrary, would reuse the properties defined in a base Product project? CppApplication 和 DynamicLibrary 这两个项目如何重用基础产品项目中定义的属性? I seems inheritance is a solution but checking https://doc.qt.io/qbs/language-introduction.html#reusing-project-file-code it didn't help.
我似乎 inheritance 是一个解决方案,但检查https://doc.qt.io/qbs/language-introduction.html#reusing-project-code它没有帮助I would like something like this:
我想要这样的东西:
// common.qbs ------------------------------------
Product
{
Properties {
condition: qbs.toolchain.contains("clang")
cpp.defines: ["COMPILER_CLANG"]
}
Properties {
condition: qbs.toolchain.contains("gcc")
cpp.defines: ["COMPILER_GCC"]
}
Group {
name: "Common files"
files: [
"common.cpp",
"common.hpp",
]
}
}
// project.qbs ------------------------------------
import "common.qbs" as Common
// app.qbs
CppApplication <inherits> Common
{
cpp.defines: outer.concat("APP")
}
// dll.qbs
DynamicLibray <inherits> Common
{
cpp.defines: outer.concat("DLL")
}
There is no multiple inheritance, so basically you have two choices: Either declare the properties in a project that both products know (eg the top-level project), or use a project-specific module.没有多个 inheritance,所以基本上你有两个选择:要么在两个产品都知道的项目中声明属性(例如顶级项目),要么使用特定于项目的模块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.