<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" 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>
<div><br>
</div>
<div><br>
</div>
Christian
<div>-- </div>
<div>Top-quoting courtesy of web interface<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> QBS <qbs-bounces+christian.kandeler=theqtcompany.com@qt-project.org> on behalf of dismine <dismine@gmail.com><br>
<b>Sent:</b> Thursday, March 17, 2016 3:11 PM<br>
<b>To:</b> qbs@qt-project.org<br>
<b>Subject:</b> [QBS] How to check minimal supported Qt version?</font>
<div> </div>
</div>
<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>
</body>
</html>