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

Иван Комиссаров abbapoh at gmail.com
Sun Jul 7 16:40:10 CEST 2019

No, this is not possible. The reason is that in common case those products (applications, libraries) will diverge in some way. For example, you might want to use different resources - icons (you probably do not want to name them icon1.png and icon2.png, right?), .desktop entires on Linux, plist files on Mac…

However, you might want to share some properties among those applications - that can be achieved via inheritance - you inherit the CppApplication item in a file, say, MyApplication.qbs, specify common properties (cpp.cxxFlags, cpp.cxxLanguageVersion, etc…) and then instantiate MyApplication and only specify only what’s different (files: «main1.cpp» and files: «main2.cpp» in your case). That way you don’t need to write all that boilerplate code over and over again.

> 7 июля 2019 г., в 15:58, Vincent Hui <vincenthk007 at gmail.com> написал(а):
> Hi Ivan,
> Thank you very much for creating a complete example in Rule document. That definitely helps new qbs users.
> I have another question that I didn't find answers after reading qbs doc.
> Is it possible to create CppApplication dynamically to generate multiple executables?
> For example, I have two cpp files "main1.cpp" "main2.cpp" containing one main functions respectively inside "apps" folders. I want my project can add all cpp files automatically can build all executables "main1.exe" "main2.exe" respectively.
> I know I can add all cpp files automatically by using Group. However, I don't know how to build 2 executables without hardcode 2 CppApplication.
> Thank you again,
> Vincent
> On Sat, 6 Jul 2019 at 23:15, Иван Комиссаров <abbapoh at gmail.com <mailto:abbapoh at gmail.com>> wrote:
> https://codereview.qt-project.org/c/qbs/qbs/+/267333 <https://codereview.qt-project.org/c/qbs/qbs/+/267333>
> > 6 июля 2019 г., в 15:51, Иван Комиссаров <abbapoh at gmail.com <mailto:abbapoh at gmail.com>> написал(а):
> > 
> > Ivan.
> _______________________________________________
> Qbs mailing list
> Qbs at qt-project.org <mailto:Qbs at qt-project.org>
> https://lists.qt-project.org/listinfo/qbs <https://lists.qt-project.org/listinfo/qbs>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20190707/a5f2d5bd/attachment.html>

More information about the Qbs mailing list