My CMake library, MyLibrary
, has a dependency for OtherLibrary
, that I import with a non-standard FindOtherLibrary.cmake
.
My library depends on OtherLibrary
publicly:
target_link_libraries(MyLibrary PUBLIC OtherLibrary::OtherLibrary)
When I install MyLibrary
(together with MyLibraryConfig.cmake
), and users want to link against it, they therefore need to import OtherLibrary
.
Is there a good practice regarding how to distribute FindOtherLibrary.cmake
along MyLibrary
?
Ideally, one could make things even easier for users of MyLibrary
by importing OtherLibrary
automatically from the installed config file MyLibraryConfig.cmake
, if it contains something like
include(CMakeFindDependencyMacro)
find_dependency(OtherLibrary)
and knows where FindOtherLibrary.cmake
is.
Is this at all possible?