[Qt-creator] qmake and backtick command arguments

Andrzej Telszewski atelszewski at gmail.com
Sun Feb 21 13:20:14 CET 2016


On 21/02/16 12:45, Nikos Chantziaras wrote:
> On 21/02/16 13:14, Andrzej Telszewski wrote:
>> I'm on Linux, so as a quick workaround something like this works fine:
>> INCLUDEPATH += \
>>    $$system(php-config --includes | sed -e 's:-I::g')
>>
>> that is using "sed" to remove the extra "-I".
>>
>> Is there some more qmake-like solution?
>> If not, I'm gonna stick with sed.
>
> qmake has built-in sed(-ish) functionality, through the "~=" operator.
> Here's how to clean up the php-config output:
>
>    PHP_INCLUDES = $$system(php-config --includes)
>    PHP_INCLUDES ~= "s/-I/"
>    INCLUDEPATH += $$PHP_INCLUDES
>
> But it's simpler to use the replace() function instead:
>
>    PHP_INCLUDES = $$system(php-config --includes)
>    INCLUDEPATH += $$replace(PHP_INCLUDES, "-I", "")
>
> (Note: no "$$" when specifying PHP_INCLUDES in the second line.
> replace() expects a variable as the first argument, NOT a string.)
>

Your solution seems to be working just fine.

I ended up with:
PHP_INCLUDEPATH = $$system(php-config --includes)
PHP_INCLUDEPATH = $$replace(PHP_INCLUDEPATH, "-I", "")

INCLUDEPATH += \
$$PHP_INCLUDEPATH

Thanks for the help!

> However, I think Qt Creator is bugged and will not recognize the
> INCLUDEPATH here. Try and see.
>

Code browsing seems to be working just fine, so it looks like everything 
is correct (I'm on Qt Creator 3.5.1).

One more time, thanks for the help :)

> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator
>


-- 
Best regards,
Andrzej Telszewski



More information about the Qt-creator mailing list