在Linux的任何主要软件包中,运行./configure --help
将在结尾输出:
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
headers in a nonstandard directory <include dir>
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
如何使用这些变量来包含目录?我尝试运行./configure --CFLAGS="-I/home/package/custom/"
和./configure CFLAGS="-I/home/package/custom/"
,但这些都不起作用。有什么建议吗?
答案 0 :(得分:5)
-I
需要使用的变量是CPPFLAGS
,而不是CFLAGS
。 (正如它在您复制的帮助消息中所说的那样。)CPP代表“C预处理器”,而不是C ++。所以:
./configure CPPFLAGS='-I/home/package/custom'
答案 1 :(得分:1)
这些不是传递给configure的标志。这些是您需要设置的环境变量。例如export CFLAGS="-I foo"
。