vgteam / libhandlegraph

Library for the Handle Graph abstraction
MIT License
20 stars 3 forks source link

Install a CMake config to enable find_package(libhandlegraph) #95

Closed adamnovak closed 10 months ago

adamnovak commented 11 months ago

Now if you find_package(libhandlegraph), and the CMAKE_INSTALL_PREFIX that libhandlegraph installed into is in your CMAKE_PREFIX_PATH, you will see libhandlegraph::handlegraph_static and libhandlegraph::handlegraph_shared targets, and $libhandlegraph_FOUND will be true.

If you want to fall back to a bundled libhandlegraph, you can poll that variable and, if it isn't set, add libhandlegraph as a subdirectory and alias is targets into the namespace, and then you can just use the namespaced targets for the rest of the build.

adamnovak commented 11 months ago

The CMake code for this is mostly copied out of the documentation at https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#creating-packages