如何在OS X上轻松安装clang with brew来设置boost
How to set up boost easily with clang with brew installation on OS X
我在OS X上通过brew安装了boost 1.60,El Capitan 10.11.4
> brew install boost
==> Downloading https://homebrew.bintray.com/bottles/boost-1.60.0_1.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring boost-1.60.0_1.el_capitan.bottle.tar.gz
/usr/local/Cellar/boost/1.60.0_1: 11,139 files, 436.0M
然而,在我的clang工具链中使用<boost/...>
并不容易。它根本找不到boost目录。
> make
Scanning dependencies of target foo
[ 50%] Building CXX object CMakeFiles/foo.dir/foo.cpp.o
foo.cpp:16:10: fatal error: 'boost/type_index.hpp' file not found
#include <boost/type_index.hpp>
^
1 error generated.
我知道我必须设置一些环境变量或添加-I
。但我想看看解决这个问题的最佳方法。
根据描述,我认为您的问题有两种可能的解决方案
-
在本地某个地方安装boost,并将boost_ROOT变量设置到该文件夹中。
-
将boost的include和libraries变量更新到相应的boost brew目录中。
以下是您需要添加到CMakeLists.txt 的代码段
set(Boost_NO_SYSTEM_PATHS TRUE)
if (Boost_NO_SYSTEM_PATHS)
set(BOOST_ROOT "${ROOT_DIR}/")
set(BOOST_INCLUDE_DIRS "${ROOT_DIR}/include")
set(BOOST_LIBRARY_DIRS "${ROOT_DIR}/lib")
endif (Boost_NO_SYSTEM_PATHS)
相关文章:
- 奇怪的结构&GCC&clang(void*返回类型)
- 数据成员SFINAE的C++17测试:gcc vs clang
- 当我编译webrtc服务器时,Windows上只支持clang-cl
- 为什么在Windows上的VS 2019和Clang 9中"size_t"在没有标题的情况下工作
- Problems with std::cin.fail()
- 我可以将一个用clang c++11编译的对象与另一个用c++17编译的对象链接起来吗
- -fsanitize=Address with clang++ 与 g++ 的不同输出
- 在Visual Studio中使用OpenMP with Clang和CMake
- OpenMP 4.5 on Windows with Clang, CMake & Ninja
- 为什么 clang ++ 编译代码而 clang -x C++ 失败?ncurses with std::string.
- Placement of const with clang-format
- Travis CI with Clang 3.4 and C++11
- Clang bug with std::function, std::bind and std::ref?
- "Typedef redefinition with different types" Clang中关于工作MSVC代码的错误
- OpenMP with clang
- gcc 未给出的 Clang 错误"attempted to construct a reference element in a tuple with an rvalue"
- 如何在OS X上轻松安装clang with brew来设置boost
- 在 linux 上使用 -fsanitize=memory with clang with libstdc++
- Using Clang 3.6 with MinGW w64 4.8
- OSX "clang++ -lboost_mpi" ' -> "ld: library not found for -lboost_mpi" 后冲泡安装提升 --with-mpi