<div dir="ltr">Thanks you, i think i have found good example.<div><br></div><div><div>import qbs</div><div>import QbsFunctions</div><div><br></div><div>Product {</div><div>    Depends { name: "Qt.core" }</div><div>    property string minimumQtVersion: "5.1.0"</div><div>    condition: QbsFunctions.versionIsAtLeast(Qt.core.version, minimumQtVersion)</div><div>}</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 17, 2016 at 4:54 PM, Kandeler Christian <span dir="ltr"><<a href="mailto:Christian.Kandeler@theqtcompany.com" target="_blank">Christian.Kandeler@theqtcompany.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>I usually just disable my product if a condition is not met:</p>
<p>    Product {</p>
<p>        Depends { name: "Qt.core" }</p>
<p>        condition: Qt.core.versionMajor >= 5</p>
<p>    }</p>
<p>You could also throw an error there, but you normally don't want to, because you'd like to be able to open the project in an IDE anyway, even if it cannot be built.</p>
<p>For a more generic version number check, you'd write a JavaScript function. See for instance qbs-resources/imports/QbsFunctions/functions.js in the qbs sources.</p><span class="HOEnZb"><font color="#888888">
<div><br>
</div>
<div><br>
</div>
Christian
<div>-- </div>
</font></span><div><span class="HOEnZb"><font color="#888888">Top-quoting courtesy of web interface<br>
<br>
</font></span><div style="color:rgb(0,0,0)"><span class="HOEnZb"><font color="#888888">
<hr style="display:inline-block;width:98%">
<div dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> QBS <qbs-bounces+christian.kandeler=<a href="mailto:theqtcompany.com@qt-project.org" target="_blank">theqtcompany.com@qt-project.org</a>> on behalf of dismine <<a href="mailto:dismine@gmail.com" target="_blank">dismine@gmail.com</a>><br>
<b>Sent:</b> Thursday, March 17, 2016 3:11 PM<br>
<b>To:</b> <a href="mailto:qbs@qt-project.org" target="_blank">qbs@qt-project.org</a><br>
<b>Subject:</b> [QBS] How to check minimal supported Qt version?</font>
<div> </div>
</div></font></span><div><div class="h5">
<div>
<div dir="ltr">Hello,
<div><br>
</div>
<div>Yesterday i finally decided to start porting my project to qbs. I really like ideas behind qbs and feel that it worth time i'll spend on porting.</div>
<div><br>
</div>
<div>Can someone help me with my first problem? In qmake i write:</div>
<div>
<pre style="margin-top:0px;margin-bottom:0px">!minQtVersion(5,<span style="color:rgb(192,192,192)"> </span>0,<span style="color:rgb(192,192,192)"> </span>0)<span style="color:rgb(192,192,192)"> </span>{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">message</span>("Cannot<span style="color:rgb(192,192,192)"> </span>build<span style="color:rgb(192,192,192)"> </span>Valentina<span style="color:rgb(192,192,192)"> </span>with<span style="color:rgb(192,192,192)"> </span>Qt<span style="color:rgb(192,192,192)"> </span>version<span style="color:rgb(192,192,192)"> </span>$${<span style="color:rgb(128,0,128)">QT_VERSION</span>}.")</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">error</span>("Use<span style="color:rgb(192,192,192)"> </span>at<span style="color:rgb(192,192,192)"> </span>least<span style="color:rgb(192,192,192)"> </span>Qt<span style="color:rgb(192,192,192)"> </span>5.0.0.")</pre>
<pre style="margin-top:0px;margin-bottom:0px">}</pre>
</div>
<div><br>
</div>
<div>Code for the function:</div>
<div>
<pre style="margin-top:0px;margin-bottom:0px">defineTest(minQtVersion)<span style="color:rgb(192,192,192)"> </span>{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>maj<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span>$$1</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>min<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span>$$2</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>patch<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span>$$3</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>isEqual(<span style="color:rgb(128,0,128)">QT_MAJOR_VERSION</span>,<span style="color:rgb(192,192,192)"> </span>$$maj)<span style="color:rgb(192,192,192)"> </span>{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>isEqual(<span style="color:rgb(128,0,128)">QT_MINOR_VERSION</span>,<span style="color:rgb(192,192,192)"> </span>$$min)<span style="color:rgb(192,192,192)"> </span>{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span>isEqual(<span style="color:rgb(128,0,128)">QT_PATCH_VERSION</span>,<span style="color:rgb(192,192,192)"> </span>$$patch)<span style="color:rgb(192,192,192)"> </span>{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">                </span>return(true)</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span>}</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span>greaterThan(<span style="color:rgb(128,0,128)">QT_PATCH_VERSION</span>,<span style="color:rgb(192,192,192)"> </span>$$patch)<span style="color:rgb(192,192,192)"> </span>{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">                </span>return(true)</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span>}</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>}</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>greaterThan(<span style="color:rgb(128,0,128)">QT_MINOR_VERSION</span>,<span style="color:rgb(192,192,192)"> </span>$$min)<span style="color:rgb(192,192,192)"> </span>{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span>return(true)</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>}</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>}</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>greaterThan(<span style="color:rgb(128,0,128)">QT_MAJOR_VERSION</span>,<span style="color:rgb(192,192,192)"> </span>$$maj)<span style="color:rgb(192,192,192)"> </span>{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>return(true)</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>}</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>return(false)</pre>
<pre style="margin-top:0px;margin-bottom:0px">}</pre>
</div>
<div><br>
</div>
<div>How can i repeat the same with qbs?</div>
<div><br>
</div>
<div>Of course, i can skip this part and go further, but i rather not if i can.</div>
<div><br>
</div>
<div>Best regards,</div>
<div>Roman </div>
</div>
</div>
</div></div></div>
</div>
</div>
</div>

<br>_______________________________________________<br>
QBS mailing list<br>
<a href="mailto:QBS@qt-project.org">QBS@qt-project.org</a><br>
<a href="http://lists.qt-project.org/mailman/listinfo/qbs" rel="noreferrer" target="_blank">http://lists.qt-project.org/mailman/listinfo/qbs</a><br>
<br></blockquote></div><br></div>