[Qt-creator] qmake and backtick command arguments
Nikos Chantziaras
realnc at gmail.com
Mon Feb 22 12:24:11 CET 2016
On 22/02/16 12:41, Andrzej Telszewski wrote:
> With:
> QMAKE_CFLAGS += $$system(php-config --includes)
>
> I get:
> -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM
> -I/usr/include/php/Zend -I/usr/include/php/ext
> -I/usr/include/php/ext/date/lib
>
> and with:
> PHP_INCLUDEPATH = $$system(php-config --includes)
> PHP_INCLUDEPATH = $$replace(PHP_INCLUDEPATH, "-I", "")
>
> INCLUDEPATH += \
> $$PHP_INCLUDEPATH
>
> I get:
> -isystem /usr/include/php -isystem /usr/include/php/main -isystem
> /usr/include/php/TSRM -isystem /usr/include/php/Zend -isystem
> /usr/include/php/ext -isystem /usr/include/php/ext/date/lib
>
> The output of php-config --includes is:
> $ php-config --includes
> -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM
> -I/usr/include/php/Zend -I/usr/include/php/ext
> -I/usr/include/php/ext/date/lib
"-isystem" is actually the recommended flag for specifying system
include files. See:
https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html#Directory-Options
So it seems qmake is being smart here and does the correct thing. If you
want to also cover the case where php-config might use "-isystem"
instead of "-I" on some machines, you can just replace that too:
PHP_INCLUDEPATH = $$system(php-config --includes)
PHP_INCLUDEPATH = $$replace(PHP_INCLUDEPATH, "-I", "")
PHP_INCLUDEPATH = $$replace(PHP_INCLUDEPATH, "-isystem", "")
More information about the Qt-creator
mailing list