简体   繁体   English

如何重用 Qbs 项目的属性?

[英]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.

相关问题 在C项目.c文件中的函数中,如何重用已分配的内存,这样我就不会经常执行无malloc的操作? - in a function inside a .c file from a C project, how to reuse a allocated memeory so that I dont do malloc-free frequently? 基于现有项目创建新项目(项目重用) - Creating a new project based on an existing project (Project Reuse) 创建包含属性和依赖项的mvn项目 - Create mvn project including properties and dependencies 项目没有default.properties文件 - Project has no default.properties file 如何在Xamarin.iOS项目中使用自定义条件属性排除程序集引用 - How to exclude assembly reference using custom conditional properties in Xamarin.iOS project 在使用终端创建测试项目时,无法在android studio中加载主项目的project.properties - Unable to load the main project's project.properties in android studio while creating a test project using terminal 库项目的Android .properties文件被覆盖 - Android .properties file of library project overwritten 为什么Project / Properties / Android不能在Eclipse中运行? - Why does Project/Properties/Android not work in Eclipse? Visual Studio 2010中项目(.vcproj)属性的继承 - Inheritance of project (.vcproj) properties in Visual Studio 2010 独立于安装的visual-C ++项目属性 - Installation independent visual-C++ project properties
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM