我已经用自制软件安装了libfmt。文件可以在/usr/local/lib/libfmt.dylib
和/usr/local/include/fmt
中找到。从形式上讲,它们是到/usr/local/Cellar/...
的链接。
默认情况下,G++不搜索/usr/local/include/和/usr/local/lib/。我不想在项目层面添加它们。
❯❯❯ g++-9 -print-search-dirs
install: /usr/local/Cellar/gcc/9.3.0_1/lib/gcc/9/gcc/x86_64-apple-darwin18/9.3.0/
programs: =/usr/local/Cellar/gcc/9.3.0_1/libexec/gcc/x86_64-apple-darwin18/9.3.0/:/usr/local/Cellar/gcc/9.3.0_1/libexec/gcc/x86_64-apple-darwin18/9.3.0/:/usr/local/Cellar/gcc/9.3.0_1/libexec/gcc/x86_64-apple-darwin18/:/usr/local/Cellar/gcc/9.3.0_1/lib/gcc/9/gcc/x86_64-apple-darwin18/9.3.0/:/usr/local/Cellar/gcc/9.3.0_1/lib/gcc/9/gcc/x86_64-apple-darwin18/:/usr/local/Cellar/gcc/9.3.0_1/lib/gcc/9/gcc/x86_64-apple-darwin18/9.3.0/../../../../../../x86_64-apple-darwin18/bin/x86_64-apple-darwin18/9.3.0/:/usr/local/Cellar/gcc/9.3.0_1/lib/gcc/9/gcc/x86_64-apple-darwin18/9.3.0/../../../../../../x86_64-apple-darwin18/bin/
libraries: =/usr/local/Cellar/gcc/9.3.0_1/lib/gcc/9/gcc/x86_64-apple-darwin18/9.3.0/:/usr/local/Cellar/gcc/9.3.0_1/lib/gcc/9/gcc/x86_64-apple-darwin18/9.3.0/../../../../../../x86_64-apple-darwin18/lib/x86_64-apple-darwin18/9.3.0/:/usr/local/Cellar/gcc/9.3.0_1/lib/gcc/9/gcc/x86_64-apple-darwin18/9.3.0/../../../../../../x86_64-apple-darwin18/lib/:/usr/local/Cellar/gcc/9.3.0_1/lib/gcc/9/gcc/x86_64-apple-darwin18/9.3.0/../../../x86_64-apple-darwin18/9.3.0/:/usr/local/Cellar/gcc/9.3.0_1/lib/gcc/9/gcc/x86_64-apple-darwin18/9.3.0/../../../
您可以通过在shell中设置相关的环境变量来实现这一点,例如:
export CPATH=...
export LIBRARY_PATH=...