Use target_link_libraries rather than link_libraries.