CMake 没有找到 Boost
问题描述
我正在尝试安装 CGAL.他们将安装过程描述为非常简单这里,第 6.1 节.当我运行 cmake-gui
然后单击 configure
时,我得到以下输出:
I am trying to install CGAL. They describe their installation process as ever-so-simple here, section 6.1. When I run cmake-gui
and then click configure
, I get the following output:
但我确实在 CMake 的 GUI 中将 BOOST_ROOT
设置为存在的 D:/program files/boost_1_51
.而且它提到的两个库肯定是安装的.这里发生了什么?我需要做什么?
But I did set up BOOST_ROOT
, in CMake's GUI, to D:/program files/boost_1_51
, which exists. And the two libraries it mentions are definitely installed. What is happening here? What do I need to do?
附上运行cmake -DBoost_DEBUG=ON
时的输出:
(我看到至少三个与这个问题标题相同的问题.每个问题都有不同的答案,对 OP 有用,但对我不起作用,所以我很抱歉重复这个问题......)
推荐答案
您的输出显示 CMake 正在以下位置搜索库:
Your output shows that CMake is searching for the libraries in the following places:
它还表明它希望以某种方式命名库.比如Boost.Thread的release版本:
It also shows that it's expecting the libraries to be named in a certain way. For example, the release version of Boost.Thread:
如果您的 Boost 库确实存在于搜索到的位置之一,那么问题可能是库的名称.您可以通过设置与 FindBoost 模块.
If your Boost libraries do exist in one of the searched locations, then it's probably the name of the library that's the problem. You can adjust the expected name of the Boost libraries by setting the appropriate CMake variables relevant to the FindBoost module.
例如,如果您使用带有 link=static threading=multi
的 bjam 构建 Boost,则在 find_package(Boost ...)
之前的 CMakeLists.txt 中,您将想做
For example, if you built Boost using bjam with link=static threading=multi
then in your CMakeLists.txt before find_package(Boost ...)
you'll want to do
或者使用 -DBoost_USE_STATIC_LIBS=ON -DBoost_USE_MULTITHREADED=ON
调用 CMake.
Or invoke CMake with -DBoost_USE_STATIC_LIBS=ON -DBoost_USE_MULTITHREADED=ON
.
正如@noam 在下面的评论中指出的那样,在这种特殊情况下,CGAL 似乎需要 Boost 库的共享 (DLL) 版本;在命令行上传递 -DBoost_USE_STATIC_LIBS=ON
没有任何效果.
As @noam has pointed out in the comments below, in this particular case, it appears that CGAL requires the shared (DLL) versions of the Boost libraries; passing -DBoost_USE_STATIC_LIBS=ON
on the command line doesn't have any effect.
这篇关于CMake 没有找到 Boost的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!