The University of Cambridge has announced it will divest from companies involved in producing "controversial weapons".