Fix missing dependency specification.

Because targets are linked via their full paths in
target_link_libraries, CMake does not automatically know the
dependencies between different targets. Therefore, we need to manually
specify the dependencies of each target.