OSX 10.10 CMake 3.0.2和clang将不会找到本地头 [英] OSX 10.10 CMake 3.0.2 and clang won't find local headers
问题描述
在OSX 10.9上,我在
On OSX 10.9 I had installed a variety of header libraries under
/usr/include
/usr/local/include
今天我对Yosemite做了免费升级,突然一切都停止了。
与Yosemite一起,我也(以前)升级Xcode(注意,我不是使用Xcode编译,而是直接通过命令行进行编译)。
And everything worked fine. Today I did the "free upgrade" to Yosemite, and suddenly everything stopped working. Together with Yosemite, I also (previously) upgraded Xcode (note, I am not compiling using Xcode, but clang directly via command line).
显示包含/ usr / include的CMakeLists.txt。
I have a CMakeLists.txt which clearly includes /usr/include
set(INCLUDE_HEADERS ${INCLUDE_HEADERS}
/usr/include
/usr/local/include)
include_directories(SYSTEM ${INCLUDE_HEADERS})
但是,当我尝试编译,我马上得到:
Yet, when I try to compile, I instantly get:
fatal error: 'boost/lexical_cast.hpp' file not found
#include <boost/lexical_cast.hpp>
这里发生了什么?任何人都体验到这一点,甚至知道如何解决呢?
我在10.9版本中工作得很好(我为什么要升级?)
我也可能做错了,因为我注意到cmake升级到3.0.2
What's going on here? Anyone else experience this, or even know how to solve it? Things were working fine in 10.9 (oh why did I upgrade?) I may also be doing something wrong as I noticed that cmake was upgraded to 3.0.2
推荐答案
这种情况的规范方法是:
Canonical way for such situations is:
find_package(boost REQUIRED)
if(Boost_FOUND)
include_directories(${boost_INCLUDE_DIRS})
endif()
b $ b
它将把BOOST头的路径添加到编译器搜索路径中。
It will add path to the BOOST header into compiler search path.
这篇关于OSX 10.10 CMake 3.0.2和clang将不会找到本地头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!