0

我无法弄清楚为什么会出现此错误。

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/libBOOST_ROOT=D:/Shark/boost_1_48_0.

4

2 回答 2

0

我正在通过下载源文件来构建 boost 库。问题是它没有创建 .dll(只有 .lib)。

我下载了 boost 二进制文件并从安装程序安装它以获取这些文件,并设置路径BOOL_LIBRARYDIR=C:/local/boost/lib64-msvc-14.0BOOL_ROOT=C:/local/boost完成它。

于 2016-12-14T04:21:30.137 回答
0

CMake 的FindBoost宏会根据您使用的编译器在各个位置查找库。即使您指定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

您会注意到mtfor 多线程构建和gd表明它是一个调试构建。FindBoost 很挑剔,如果您的 CMake 项目具有 CMAKE_BUILD_TYPE=Debug,它将寻找调试版本

此外,如果您构建多线程,您需要定义:

Boost_USE_MULTITHREADED=ON

如果您仍然遇到问题,请定义:Boost_DEBUG=1 并且您会看到很多关于 FindBoost 搜索方式和位置的附加输出。

于 2016-12-13T05:01:02.547 回答