[Qbs] Exporting libraries to link only for MinGW

Björn Schäpers qt-maillist at hazardy.de
Sat Feb 22 11:27:56 CET 2020

Am 22.02.2020 um 09:56 schrieb Richard Weickelt:
>> You don't need a group here in the first place. Just
>> cpp.dynamicLibraries: {
>>     var libs = [];
>>     if(qbs.toolchain.contains("mingw"))
>>         libs = libs.concat(["pthread", "ole32"] )
>>     return libs;
>> }
> Or to be more explicit: You **must** not use the Group item for this purpose. The Group item selects file artifacts by name or tag and assigns module properties to them. Since You don’t select any artifacts, the Group has no effect. You probably want to use the Properties item (which works in modules as well. The limitation is that only one Properties item should write the same module property at a time (mutual exclusive). But that seems to be the case in your example.
> Richard


Properties seems to be exactly what I want.

Here what I have now:
    StaticLibrary {
         files: ["date/include/date/*.h", "date/src/*.cpp"]
         name: "date"

         Depends { name: "cpp" }

         cpp.cxxLanguageVersion: "c++17"
         cpp.defines: ["HAS_REMOTE_API=0","AUTO_DOWNLOAD=0","INSTALL=."]
         cpp.includePaths: ["date/include"]

         Export {
             Depends { name: "cpp" }

             cpp.defines: product.cpp.defines
             cpp.includePaths: ["date/include"]

             Properties {
                 condition: qbs.toolchain.contains("mingw")

                 cpp.dynamicLibraries: ["pthread", "ole32"]

More information about the Qbs mailing list