You can specify the relationship between a
and b
by adding
target_link_libraries(b a)
From the docs:
Library dependencies are transitive by default. When this target is linked into another target then the libraries linked to this target will appear on the link line for the other target too.
So, if you specify a
as a dependency of b
in this way, you don’t even need to explicitly list a
in any target which depends on b
, i.e. your other command can be just:
target_link_libraries(dummy b)
although it wouldn’t do any harm to list a
as well.