cmake的找不到Boost库,因为它会查找错误的文件名 [英] cmake can't find boost libraries because it looks for the wrong file names
问题描述
我根据文档(8.1)该机内置升压(1.56)在Windows库,无论是作为共享和静态库。结果
他们都在 BOOST_ROOT /台/ lib目录
目录出现在以下文件名格式为:
I've built the boost (1.56) libraries on a windows (8.1) machine according to the documentation, both as shared and static libraries.
All of them appear in the BOOST_ROOT/stage/lib
directory in the following file name format:
boost_thread-vc120-mt-1_56.dll
boost_thread-vc120-mt-1_56.lib
boost_thread-vc120-mt-gd-1_56.dll
boost_thread-vc120-mt-gd-1_56.lib
(这只是线程lib中,相同的格式用于所有其他库以及)
(this is just the thread lib, the same format is used for all the other libs as well)
当我运行cmake它抱怨不能够找到Boost库。结果
与 -DBoost_DEBUG =上运行它
显示,它会查找不同的文件名:
When I run cmake it complains about not being able to find the boost libraries.
Running it with -DBoost_DEBUG=ON
shows that it looks for different file names:
libboost_thread-vc120-mt-s-1_56;
libboost_thread-vc120-mt-s;
libboost_thread-mt-s-1_56;
libboost_thread-mt-s;
libboost_thread
我注意到以下区别:
I noticed the following differences:
- 实际文件的preFIX是
升压
,而不是libboost
作为cmake的正在搜索 - 的实际文件的静态版本只是有一个不同的文件扩展名(.LIB而不是.dll文件),但CMake的寻找
-mt-S
- The prefix for the actual files is
boost
and notlibboost
as cmake is searching for - The static version of the actual files just has a different file extension (.lib instead of .dll) but cmake is looking for
-mt-s
任何想法,我怎样才能使CMake的找到实际的文件,而不是重命名我要匹配cmake的搜索格式文件?
Any idea how I can make cmake find the actual files without renaming the files I have to match cmake's search formats?
感谢
推荐答案
请注意: boost_thread-VC120-MT-1_56.lib
是导入库允许与 boost_thread-VC120-MT-1_56.dll
,而 libboost_thread-VC120-MT-S-1_56
是静态的库(取值
信意味着它也与静态链接CRT)。
Note: boost_thread-vc120-mt-1_56.lib
is an import library allowing dynamic linking with boost_thread-vc120-mt-1_56.dll
, while libboost_thread-vc120-mt-s-1_56
is a static library (s
letter means it's also statically linked with CRT).
您尝试构建的应用程序有预计静态CRT,所以你应该为他们提供静态Boost库。要建立这样的图书馆,调用 B2
通过的合适的参数的:
The application you try to build expects static Boost libraries having static CRT, so you should provide them. To build such libraries, invoke b2
with the appropriate parameters:
b2 variant=release link=static runtime-link=static stage
这篇关于cmake的找不到Boost库,因为它会查找错误的文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!