现在,我需要使用 CMake Error at /usr/share/cmake/Modules/FindBoost.cmake:1138 (message):
Unable to find the requested Boost libraries.
Boost version: 1.41.0
Boost include path: /usr/includ
Detected version of Boost is too old.
Requested version was 1.62 (or
newer).
将一些lib包含到我的程序中,但我的boost库安装在其他目录中,而不是在defualt目录中**(usr / include ..)**。现在它发生以下错误:
SET(BOOST_DIR /home/mingjli/folder_Mingjie/Software/boost_1.62.0/include/boost)
SET(BOOST_LIB /home/mingjli/folder_Mingjie/Software/boost_1.62.0/lib)
INCLUDE (${Source_Path}/IndexerLauncher.cmake NO_POLICY_SCOPE)
INCLUDE_DIRECTORIES(${BOOST_DIR})
LINK_DIRECTORIES(${BOOST_LIB})
INCLUDE_DIRECTORIES(${Source_Path})
ADD_EXECUTABLE (indexer_launcher ${IndexerLauncher})
TARGET_LINK_LIBRARIES (indexer_launcher nearest_search_lib)
target_link_libraries( indexer_launcher ${Boost_LIBRARIES} )
我提供了我的CMakelist.txt的一些内容:
bower install
谢谢!
答案 0 :(得分:1)
Boost version: 1.41.0
^^
这意味着,您安装了升级版本1.41.0,但是您要求1.62.0。您可以更新提升或更改最小提升版本要求:
find_package(Boost 1.41.0 COMPONENTS program_options serialization system filesystem thread REQUIRED)
^^
你的CMakeLists.txt中没有什么特别的东西可以包含Boost。这是一个适合我的示例:
cmake_minimum_required(VERSION 2.8)
find_package(Boost REQUIRED filesystem system)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(mytarget ${Boost_LIBRARIES})
<强>更新强> 如果您无法更新系统升级版本,则可以将boost安装到您的主文件夹中:
将新的boost编译并安装到您的主目录:
b2 toolset=gcc install --prefix=/home/user/boost
编译boost后 - 您可以在/ home / user / boost:
中使用它cmake .. -DBOOST_ROOT=/home/user/boost