|
Boost : |
Subject: Re: [boost] CMake Modularization
From: Peter Dimov (lists_at_[hidden])
Date: 2016-10-02 21:22:00
Paul Fultz II wrote:
> Instead a top-level cmake can bring the packages together, something like:
>
> set(BOOST_ALL TRUE)
> # Whatever cmake modulues boost provide
> include(cmake/BoostModules.cmake)
Something like that, although BOOST_ALL does not strike me as quite correct
a name, I'd call that BOOST_IS_LOCAL. (It doesn't have to be all of Boost,
could be a subset.)
We'll probably also need
set(BOOST_ROOT ${CMAKE_SOURCE_DIR})
> # Include the libraries
> # Perhaps this could be globbed
> add_subdirectory(libs/fit)
> add_subdirectory(libs/hana)
It has to be globbed, for the same reason. Subsets should be supported.
> Then in the library, the cmake would do something like this:
>
> # We are building standalone
> if(NOT BOOST_ALL)
> # BoostModules must be installed first, before building standalone
> find_package(BoostModulues)
> endif()
>
> # Find the dependent boost libraries
> find_boost_lib(BOOST_LIBS asio hana)
>
> So now, when building standalone `find_boost_lib` will call `find_package`
> to retrieve the exported targets. If its building in-tree, then
> `find_boost_lib` will just find the target name, and let cmake resolve the
> target during build.
Yes, this could work for possibly-standalone libraries.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk