我无法弄清楚为什么会收到此错误。
CMake Error at C:/Program Files/CMake/share/cmake-3.6/Modules/FindBoost.cmake:1753 (message):
Unable to find the requested Boost libraries.
Boost version: 1.48.0
Boost include path: D:/Shark/boost_1_48_0
Could not find the following Boost libraries:
boost_system
boost_date_time
boost_filesystem
boost_program_options
boost_serialization
boost_thread
boost_unit_test_framework
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
Call Stack (most recent call first):
CMakeLists.txt:146 (find_package)
CMake Error at CMakeLists.txt:154 (message):
Please make sure Boost 1.48.0 is installed on your system
它说,无法找到请求的升级库。但我已经安装了boost 1.48.0并使用Visual Studio控制台构建它,并已通过BOOST_LIBRARYDIR=D:/Shark/boost_1_48_0/stage/lib
和BOOST_ROOT=D:/Shark/boost_1_48_0
。
答案 0 :(得分:0)
CMake的FindBoost
宏根据您使用的编译器在各个位置查找lib。即使您指定BOOST_LIBRARYDIR
,您仍然必须符合FindBoost
宏对文件名所期望的标准,即:
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
${Boost_LIB_PREFIX}boost_${COMPONENT} )
与visual studio 2013(又名msvc 12)匹配此模板的示例文件名
$BOOST_LIBRARY_DIR/boost_atomic-vc120-mt-1_58.dll
$BOOST_LIBRARY_DIR/boost_atomic-vc120-mt-gd-1_58.dll
您会注意到多线程版本的mt
和gd
表示它是一个调试版本。如果你的CMake项目有一个CMAKE_BUILD_TYPE = Debug
此外,如果你的建筑多线程,你需要定义:
Boost_USE_MULTITHREADED=ON
如果您仍然遇到问题,请定义:Boost_DEBUG=1
,您会看到很多关于FindBoost搜索方式和位置的其他输出。
答案 1 :(得分:0)
我是通过下载源文件来构建boost库的。问题是它没有创建.dll(只有.lib)。
我下载了boost二进制文件并从安装程序安装它以获取这些文件,并设置路径BOOL_LIBRARYDIR=C:/local/boost/lib64-msvc-14.0
和BOOL_ROOT=C:/local/boost
以完成它。