Use target definitions generated by cmake
Instead of the manual definition of an imported target, just use the one that CMake has generated.
The namespace of the exported targets is set to CrestApiLib::
so the final target name is the same as before. Unlike the hand made version it has all the correct dependencies and other properties like include paths.
find_dependency() has to be called in the CrestApiLibConfig.cmake file before including the generated targets (the QUIET and REQUIRED options are automatically forwarded, so no need to specify them).
Merge request reports
Activity
I tested this in a complete standalone setup (just compiler and cmake from LCG, and CMAKE_PREFIX_PATH for Boost and jsonmcpp (nlohmann_json) as well as in a full local tdaq-common build. In both cases one can just
find_package(CrestApiLib REQUIRED) target_link_library(sometarget PRIVATE CrestApiLib::CrestApiLib)
So for TDAQ this will be fine.
mentioned in commit e77f6cbc