[Qt-creator] qmake and backtick command arguments

Nikos Chantziaras realnc at gmail.com
Sun Feb 21 12:45:14 CET 2016


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.)

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




More information about the Qt-creator mailing list