On Mon, Jun 19, 2017 at 5:14 PM, P F
On Jun 19, 2017, at 3:58 AM, Olaf van der Spek via Boost
wrote: On Sat, Jun 17, 2017 at 3:36 PM, P F via Boost
wrote: It would be nice to not just support cmake, but pkgconfig as well. There are many times I need to use boost in non-cmake projects, so having pkgconfig would be helpful as well.
I don't really get find_package and pkgconfig etc.
I use package management to install the dependencies I need. I then include and link to the stuff I need. It'd be nice if the linking was automatic like it is on MSVC but okay.
Why does one need all kinds of extra complexity in every single make file for things like find_package or pkgconfig?
I find writing something like `g++ $(pkgconfig boost_asio --cflags —libs) foo.cpp` much easier to write. In fact, I would need some investigating to know what flags I need. Other users would like boost to support pkgconfig as well as there are tickets open for this. Almost the same applies for `find_package` in cmake as well.
`g++ foo.cpp` would be even easier.. but Linux still doesn't support auto-linking like GCC AFAIK. Such dependencies for header-only libs are a problem though, I agree. Do other libs have the same problem?
It doesn’t add too much complexity. The files for pkgconfig are a simple text format, and for find_package, cmake can already generate the code the exported target. What is different is that all the dependencies between boost libraries are explicit. So the `boost_core-config.cmake` look like this:
include(CMakeFindDependencyMacro) find_dependency(boost_config) find_dependency(boost_assert) # Include the targets generated by cmake include("${CMAKE_CURRENT_LIST_DIR}/boost_core-targets.cmake”)
And then targets file is generate by calling `install(EXPORT boost_core-targets FILE FooTargets.cmake DESTINATION lib/cmake/boost_core)` in the main CMakeLists.txt.
I actually wrote BCM to help reduce this boilerplate, here:
http://bcm.readthedocs.io/en/latest/
However, I planning to refactor this from feedback I got.
-- Olaf