I recently downloaded the newest boost library to get access to boost::hana and read on their documentation page that they suggest using the "FindHana.cmake module to setup Hana as an external project for use."
I couldn't figure this out so I just set the compile flags to include my hana.hpp to the header path, but I'd love to know how to accomplish this the way suggested in the documentation.
In upcoming versions of Boost, Hana provides a file called HanaConfig.cmake
, which is installed in <install-prefix>/lib/cmake/hana/HanaConfig.cmake
automatically when you type make install
. Then, provided your <install-prefix>
is part of the CMAKE_PREFIX_PATH
(which will be the case if you install it to a default, system-wide location), you just need to:
find_package(Hana)
target_link_libraries(some-target hana)
This will add the right include directories to some-target
. This is the right way to depend on other CMake projects, and I changed Hana's way of doing it recently (on develop
only right now) in light of this.