On Jun 19, 2017, at 9:24 PM, Peter Dimov via Boost
wrote: Louis Dionne wrote:
So, normally, for a project based on CMake, these XYZConfig.cmake files can be generated automatically by using `install(EXPORT ...)`. The resulting file looks like this (for Hana):
https://gist.github.com/ldionne/df7b6888752097e25bfc2333f6d897ca#file-what-g...
Basically, we'd want to replicate the functionality provided by this module without necessarily all the boilerplate (since that's generated automatically). Here's a minimal file for Hana (a header only library):
https://gist.github.com/ldionne/df7b6888752097e25bfc2333f6d897ca#file-minima...
And here's a minimal XYZConfig.cmake file for a library with compiled sources (I added source files to Hana and turned it into a static library to check this):
https://gist.github.com/ldionne/df7b6888752097e25bfc2333f6d897ca#file-minima...
Thanks, this gives me an idea what you were proposing. One thing I notice is that you don't enumerate any dependencies. This would work fine in the case where all our header-only libraries are installed into the same include/ as one -I would be as good as any other, I suppose.
He didn’t enumerate the dependencies because in this example there wasn’t any dependencies. If there are dependencies, it would look something like this: include(CMakeFindDependencyMacro) # Bring in the boost::fusion imported target find_dependency(boost_fusion) # Bring in the boost::config imported target find_dependency(boost_config) # Snip the computing imported prefix ... set_target_properties(boost::hana PROPERTIES INTERFACE_COMPILE_FEATURES "cxx_std_14" INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include" INTERFACE_LINK_LIBRARIES "boost::fusion;boost::config" IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" IMPORTED_LOCATION "${_IMPORT_PREFIX}/lib/libhana.a" # Whatever else you need )
Then, each Boost library would simply provide a file like this and install it to the appropriate location when the library is installed.
So, if I understand correctly, you're saying that after `b2 install` in addition to the headers in $prefix/include and the built libraries in $prefix/lib, we should also copy these boost_*-config.cmake files (along with the corresponding -version files maybe?) into $prefix/lib/cmake?
Actually the files will go into $prefix/lib/cmake/boost_pumpkin
Which would then presumably enable find_package(boost_pumpkin)?
Yes.