cmake: use PUBLIC in target_link_libraries if the dependency is not internal
The clients of a given C++ module will automatically get the
library dependencies of that module if PUBLIC is used in
target_link_libraries. For the internal dependencies (not needed
by the clients of the module), PRIVATE is kept.
Fixes partially CAS-13870