[Qbs] Applying cxxFlags to certain files

Richard Weickelt richard at weickelt.de
Fri Jul 10 14:30:10 CEST 2020


On 10.07.2020 14:18, Иван Комиссаров wrote:
> You can access the original value via input.cpp.prop:
> 
> fileTags:[tag],
> 
> filePath:outputDir+"/"+FileInfo.baseName(input.fileName)+suffix,
> 
> cpp:{
> 
> includePaths:[].concat(input.cpp.includePaths,outputDir),
> 
> warningLevel:"none",
> 
> }
> 

Product should be available as well:

Artifact {
    // ...
    cpp.cxxFlags: product.cpp.cxxFlags.concat(["-flag"])
}

Another way would be, to add an additional unique filetag to your generated
artifacts and then use a Group to assign the additional cpp properties to
them. Something like that:

Module {
    // ...
    Rule {
        // ...
        Artifact {
            // ...
            fileTags: ["cpp", "specialtag"]
        }
    }
    Group {
        fileTagsFilter: "specialtag"
        cpp.cxxFlags: outer.concat(["-flag"])
    }
}

The Group item has the (fortunate or unfortunate) side effect that the
matching artifacts appear in Qt Creator as files of the product.






More information about the Qbs mailing list