Private Linking Public Compile Usage

Is there a way when linking with target to link privately and make the compile usage requirements public ?

Example

add_library(A STATIC a.c)
target_include_directories(A PUBLIC "dir1")
target_compile_definitions(A PUBLIC "A_DEFINE")

add_library(B SHARED b.c)
target_link_libraries(B PRIVATE A)

add_library(C SHARED c.c)
target_link_libraries(C PRIVATE B)

I want B library to link with A.
B includes & compile defs. to have A interface includes and & compile defs as PUBLIC.
So that, library C is not linking with B, but has includes & compile defs. of A propagated to it through library B.

I know I can set B includes & compile defs as:

target_include_directories(B PUBLIC "$<TARGET_PROPERTY:A,INTERFACE_INLCUDE_DIRECTORIES>")
target_compile_definitions(B PUBLIC "$<TARGET_PROPERTY:A,INTERFACE_COMPILE_DEFINITIONS>")

But I thought this could be too much, and probably there is easier way to do it.

You’re probably interested in this MR which adds $<COMPILE_ONLY>. You could then do:

target_link_libraries(B
  PUBLIC
    "$<COMPILE_ONLY:A>"
  PRIVATE
    A)