[Qbs] Unwanted linkage of non-cpp product by MSVC
Павел Лысенко
pahaa7 at mail.ru
Sun Oct 7 14:17:17 CEST 2018
>> I have a project with some cpp products.
>> Also the project includes a non-cpp product.
>> Non-cpp product depends on my custom module that creates a custom deployment package.
>> Module can process both cpp and non-cpp products (so it have application input artifact). Also module use path to qt binaries from Qt.core module (so it have dependency on Qt.core module)
>>
>> If I configure the project by QtCreator to use MinGW, all works fine, but if I use MSVC2017 (64 bit), it tries to link non-cpp product and fails with unresolved symbol mainCRTStartup.
>> Here is the short snippet that fails to build:
>>
>> Project {
>> Product{
>> Depends{name:"Qt.core"}
>> files:"main.txt"
>> type:"test_output"
>> Rule{
>> inputs:["some_input_tag","application"]
>> Artifact{
>> filePath:"main.txt.output"
>> fileTags:["test_output"]
>> }
>> prepare:{
>> var cmd=new JavaScriptCommand();
>> return [cmd];
>> }
>> }
>> }
>> }
>>
>> It looks like Qt.core have a dependency on cpp module, it tries to create an application artifact from 0 source files and fails on that. Is that a known issue?
>That's because the module has the Qt5Core.lib file as a target artifact, and the linker rule takes such files as inputs even if no source files are present.
>Use a redirection to prevent the cpp module from getting pulled in:
>Project {
> Product {
> name: "QtPathProvider"
> Depends { name:"Qt.core" }
> Export {
> property string qtBinPath: product.Qt.core.binPath
> // ...
> }
> }
> Product {
> Depends { name: "QtPathProvider" }
> // Use QtPathProvider.qtBinPath below
> // ...
> }
>}
Unfortunately, that is not working from a module.
Regards, Pavel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20181007/e48649ba/attachment.html>
More information about the Qbs
mailing list