在 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/"
,但是这些都不起作用。有什么建议?
最佳答案
您需要用于 -I
的变量是 CPPFLAGS
,不是 CFLAGS
. (正如您复制的帮助消息中所说的那样。)CPP 代表“C 预处理器”,而不是 C++。所以:
./configure CPPFLAGS='-I/home/package/custom'
关于include - 运行configure时如何覆盖环境变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2717623/