boost & asio as part in big project with Cmake
I want to use Boost core libraries (like lambda) and Boost ASIO library in a large cross-platform project built with 开发者_StackOverflowthe Cmake. I want to put Boost & ASIO in my source control tree and build it as part of project with the Cmake. So I don't want to "install" it on computers and link with it.
How can this be done? Does there exist CMakeLists.txt
for Boost?
Both Boost.Lambda and Boost.ASIO are header-only libraries, so in your CMakeLists.txt file, you could include your Boost include
directory in the INCLUDE_DIRECTORIES
variable, and when your code is built, the header code will be built into your resulting modules.
For situations where you are using non-header-only libraries, like Boost.Filesystem, then you will have to either ship libraries you built, or modify the experimental CMake version of boost.build, which you can find here: https://svn.boost.org/trac/boost/wiki/CMake
Edit
I was slightly confused about Boost.Asio. It is not truly header-only, because it depends on Boost.System, and possibly Boost.Thread depending on how you use it.
However, Boost.Asio is derived from Asio ( http://think-async.com/ ), which is header-only.
There is a project aiming at providing a CMake version of boost. It is quite outdated, but the CMakeLists.txt
might help you. You can check it out there.
精彩评论