How to handle transitive dependencies of a header-only library target?

I have some header-only library dependency Foo::foo which I do not want to end up in the exported targets of my library. To prevent that from happening, the library is linked as follows:

target_link_libraries(my_library 
  PRIVATE
    $<BUILD_INTERFACE:Foo::foo>
)

This works, however Foo::foo itself depends on some libraries that I do want to be exported, since symbols of those libraries end up in the resulting library. Right now, I ensure those libraries are exported as follows:

get_property(_fooInterfaceLinkLibraries TARGET Foo::foo PROPERTY INTERFACE_LINK_LIBRARIES)
target_link_libraries(my_library
  PRIVATE
    $<BUILD_INTERFACE:Foo::foo>
    $<INSTALL_INTERFACE:${_fooInterfaceLinkLibraries}>
)

Is this the ‘canonical’ approach, or is there a simpler approach? Note; using $<TARGET_PROPERTY:...> in the target_link_libraries call does not work since the generator expression itself ends up in the exported targets CMake file, still requiring the Foo::foo target to be known by any consumer.

If I understand correctly. Your application A is dependent on a header only library H, which depends on another lib L.
A needs H only for be built but it exposes symbols from L.
If that’s correct, A should link H privately AND L publicly.
A is not supposed to have any knowledge of what H depends on. If it exposes a dependency, even if it is already linked by another one, you should link it.
Theoretically, it could lead to multiple linking of L but, AFAIK, the link system (through help of cmake or not, I don’t know) will handle that smoothly.

The way you’re going seems to link against all dependencies of H, besides it will break if at some time you’re not dependent anymore to H but still to L.