The Magisterium has an infallible teaching on what makes any act moral or immoral: the three fonts of morality. The act of voting is subject to the same basic principles of ethics as every other human act.
To be moral, an act must have:
1. only good in the intention
2. only good in the moral object
3. the reasonably anticipated bad consequences must not outweigh the reasonably anticipated good consequences.
If all three fonts of morality are good, the act is moral.
Voting for a candidate who favors legalizing or keeping legal an intrinsically evil act is not necessarily immoral. That vote is not necessarily intrinsically evil, it does not necessarily have a bad intention, and circumstances vary.
We are morally obligated not to vote for a pro-life candidate IF the vote would to more harm than good.
Now it may be -- in my judgment it is the case -- that generally a vote for a pro-life candidate does more good and less harm (despite the failings of that candidate) than a vote for a pro-abortion candidate. I almost always vote pro-life (when such a candidate is running).
But it simply is not true that we can never morally vote for a pro-abortion candidate.
Roman Catholic theologian