首页 文章

CMake错误:无法找到请求的Boost库[重复]

提问于
浏览
0

这个问题在这里已有答案:

我正在尝试安装具有Boost依赖项的特定c库 . 我安装Boost没问题,包含路径在/ usr / local / include /下 .

但是,当我调用cmake时,我收到以下错误:

CMake Error at     
/usr/local/Cellar/cmake/3.3.2/share/cmake/Modules/FindBoost.cmake:1245 (message):
Unable to find the requested Boost libraries.
Boost version: 0.0.0
Boost include path: /usr/include
Detected version of Boost is too old.  Requested version was 1.36 (or newer).
Call Stack (most recent call first):
CMakeLists.txt:10 (FIND_PACKAGE)

我知道Boost包含路径不匹配,但我不知道如何让它引用正确的路径 . CMakeLists.txt文件调用FIND_PACKAGE(Boost 1.36 COMPONENTS program_options REQUIRED):我没有看到任何允许我指定路径的参数 .

谢谢,

1 回答

  • 0

    您可以使用以下命令设置Boost路径:

    SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "/.../boost")
    SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "/.../boost/lib")
    

    确保在CMakeLists.txt中的FIND_PACKAGE调用之前放置它 . (Cmake doesn't find Boost

相关问题