[Qbs] A simple project that copy an executable does not work

Richard Weickelt richard at weickelt.de
Sat Jul 6 13:40:19 CEST 2019


> I created a simple project to copy an executable generated by
> CppApplication. However the executable is not copied.
> 
> I cannot figure out why? Can anyone tell me why?

Please read
https://doc.qt.io/qbs/qml-qbslanguageitems-rule.html#rules-and-product-types

Your rule is not executed because the product type is "application" and
there is most likely no other product or rule that depends on an .out file.

You should assign a file tag to the rule's output artifact and add this file
tag to the product type. Something like this:

    CppApplication {
        type: [ "outfile"]
        // ...
        Rule {
            Artifact {
                filePath: input.fileName + ".out"
                fileTags: [ "outfile" ]
            }
            // ...
        }
    }

Why do you want to copy an application executable into an .out file? That
seems pointless. Do you maybe want to change the executable suffix? There is
an undocumented property cpp.executableSuffix which you could try:

    CppApplication {
        cpp.executableSuffix: ".out"
        // ...
    }

I don't know why it is undocumented. Maybe some linkers do not allow to
change the suffix.




More information about the Qbs mailing list