[QBS] conditional reference file

McGillion, Brian brian.mcgillion at intel.com
Sun Feb 1 20:04:44 CET 2015


Hi Dmitry,

Thanks !! That did the trick.

Br,
Brian

On Sun, Feb 1, 2015 at 8:23 PM, Dmitry Volosnykh <dmitry.volosnykh at gmail.com
> wrote:

> The following should work:
>
> Project {
>     references: {
>         var qbsList = [...]
>         if (File.exists(sourceDirectory + "/my.qbs")) {
>             qbsList.push("my.qbs")
>         }
>         return qbsList
>     }
> }
>
> On Sun, Feb 1, 2015 at 8:58 PM, McGillion, Brian <
> brian.mcgillion at intel.com> wrote:
>
>> Hi All,
>>
>> I asked this question on irc the other day, so apologies to those who are
>> being bombarded again.
>>
>> Under my Project { references : [ ] }
>>
>> I want to add a conditional reference if a file (another project's .qbs)
>> exists.
>>
>> I have tried "File.exists('my.qbs') ? 'my.qbs' : []" and
>> "File.exists('my.qbs') ? 'my.qbs' : '' "
>>
>> with the following results
>> error: Expected array element of type String at index 4.
>> error: Cycle detected while referencing file ''
>>
>> The next issue that I noticed is that "File.exists('my.qbs')" seems to
>> require and absolute path and not a relative one.
>>
>> Does anyone know the best solution that is also portable, as this is a
>> shared project so any hard coded absolute paths are not going to work too
>> well.
>>
>> Thanks in advance,
>> Brian
>>
>> _______________________________________________
>> QBS mailing list
>> QBS at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/qbs
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20150201/ab987db0/attachment.html>


More information about the Qbs mailing list