[QBS] Is that possible to using Group template?

Joerg Bornemann joerg.bornemann at digia.com
Thu Oct 10 10:45:26 CEST 2013


On 10/10/2013 05:13, 罗勇刚(Yonggang Luo)  wrote:
> For example:
>      Group {
>          name: "public buildgraph headers"
>          des:"buildgraph/"
>          prefix:des
>          qbs.install: project.installApiHeaders
>          qbs.installDir: headerInstallPrefix + des
>          files: ["forward_decls.h"]
>      }
>
> We have lots of alike Group, the only differences is name and des and files.
> how to create an Group Template to remove duplicate writting down of
> Group?

Create a file named MyGroup.qbs in the same directory as the project 
file resides. The content will be

---snip---
     Group {
         prefix:des
         qbs.install: project.installApiHeaders
         qbs.installDir: headerInstallPrefix + des
         files: ["forward_decls.h"]
     }
---snap---

In your project file then use
---snip---
     MyGroup {
         name: "public buildgraph headers"
         des: "buildgraph/"
     }
     MyGroup {
         name: "public coffee machine headers"
         des: "mr_coffee/"
     }
---snap---

That's much like QML's inheritance feature and described here:
http://doc-snapshot.qt-project.org/qbs/language-introduction.html


Cheers,

Joerg

-- 
Joerg Bornemann
Digia, Qt
http://qt.digia.com/




More information about the Qbs mailing list