CMake不会发现Boost库 [英] cmake doesn't find boost libraries

查看:257
本文介绍了CMake不会发现Boost库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用cmake的skript到Windows上编译基于提升的应用程序。
唯一的头,库做工精细,但cmakes未能找到库(以下Boost库找不到:boost_serialization)CMake的脚本的相关部分是:

I'm trying to use a cmake skript to compile a boost based application on windows. The header-only libraries work fine, but cmakes fails to find the libraries ( The following Boost libraries could not be found: boost_serialization) The relevant part of the cmake script is:

#path where cmake can find additional libraries
SET(CMAKE_PREFIX_PATH Libs)

#boost
SET(Boost_ADDITIONAL_VERSIONS "1.47" "1.47.0")
SET(Boost_USE_STATIC_LIBS   ON)
find_package(Boost REQUIRED COMPONENTS serialization)

我有一个名为利布斯我的项目中,第三方库,如魔鬼和提升存储文件夹里面,所以我首先设定该项。工作正常的魔鬼,升压仅邮件头的东西,所以我asume我不应该需要BOOST_ROOT变量。
升压安装从boost.org标准源分布,我的bjam编译。该库存储在boost_1_47_0 \\ bin.v2 \\库,我没有改变在构建过程中任何事情。
我认为这是一个有点奇怪,那boost_1_47_0 \\ libs文件夹中不包含任何库文件,但文件的bjam和其他的东西,但因为这缝是从Windows上构建促进正常的方式,不应该是一个问题源。

I have a folder called "Libs" inside my project where third party libraries such as DevIL and boost are stored, so I set this first. Works fine for Devil and boost header-only stuff, so I asume i should not need the BOOST_ROOT variable. The boost installation is the standard source distribution from boost.org which I compiled with bjam. The libraries are stored in boost_1_47_0\bin.v2\libs, I didn't change anything in the build process. I think it is a bit odd, that the boost_1_47_0\libs folder doesn't contain any library files but bjam files and other stuff, but that shouldn't be a problem since this seam to be the normal way to build boost on Windows from the source.

我看着从FindBoost.cmake输出调试(我使用的是默认的脚本CMake的2.8),并没有缝寻找到bin.v2。相反,它会搜索BOOST_ROOT / lib中,但是当我从bin.v2 \\库复制的内容,LIB仍然没有发现任何东西。

I looked at the Debug output from the FindBoost.cmake (I'M using the default script from CMake 2.8) and it doesn't seam to look into bin.v2. Instead it searches boost_ROOT/lib, but when i copied the content from bin.v2\libs to lib it still doesn't find anything.

那么,什么是找到提升一个优雅的方式,这也将与普通bosst分布等plattforms工作?

So what is an elegant way to find boost, that will also work on other plattforms with common bosst distributions?

推荐答案

好吧,我解决了这个问题,但我并不完全满意,我的解决方案。
在我看来,问题是,是的bjam创建一个复杂的文件夹结构。现在,我刚才复制的boost_1_47_0 \\ bin.v2 \\库\\序列\\ build中\\ MSVC-9.0 \\调试\\链接静态\\线程的多到boost_1_47_0 \\ LIB库文件。我有手这样做,但我不使用很多Boost库,所以这一步是确定在我看来。我会记录我的解决方案预留了CMake的脚本,以便其他用户应与相处。

Well, I solved the problem, but I'm not fully satisfied with my solution. In my opinion the problem was, that bjam create a to complex folder structure. Now I just copied the library files from "boost_1_47_0\bin.v2\libs\serialization\build\msvc-9.0\debug\link-static\threading-multi" to "boost_1_47_0\lib". I have to do this by hand but I'm not using that many boost libraries, so this step is ok in my opinion. I will document my solution aside the cmake script, so other users should get along with that.

这篇关于CMake不会发现Boost库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆