Use add_dependencies for the non-external targets.