[Qbs] Build static and dynamic libraries

Christian Kandeler christian.kandeler at qt.io
Mon Oct 30 12:00:10 CET 2017


On Mon, 30 Oct 2017 11:49:38 +0100
Stephan Gatzka <stephan.gatzka at gmail.com> wrote:

> I need to build form a single code basis both a static and a dynamic 
> library.
> 
> Because both are distinct products, I'm wondering howto write a qbs file 
> without repeating the files section in both products:
> 
> Project {
>       Product {
>           name: "p1"
>           files: "f1.c"
>       }
> 
>       Product {
>           name: "p2"
>           files: "f1.c"
>       }
> }

One possible approach:

--- MyFiles.qbs ---
Group {
    files: "f1.c"
}

--- MyProject.qbs ---
import "MyFiles.qbs" as MyFiles

Project {
    Product {
        name: "p1"
        MyFiles { }
    }

    Product {
        name: "p2"
        MyFiles { }
    }
}


Christian



More information about the Qbs mailing list