It is nonsense to say "You can't legislate morality." That's not an argument. All laws legislate morality.
The real question is When is a law destructive of the common good? A law that cannot be enforced, or would require a police state for its enforcement, would be destructive of the common good.
Thus, "you can't legislate morality" is a bogus argument against outlawing abortion. Since abortion is homicide, outlawing it is clearly in the interest of the common good. Anyone who wants it to be legal has to demonstrate that abortion laws are destructive of the common good, as, say, a law requiring every citizen to recite the Rosary every day would be destructive of the common good.
A person who wants abortion to be legal has to argue that outlawing it is destructive to society. "You can't legislate morality" is nothing but a dishonest slogan.
How are laws authorizing pork barrel projects enforcing some moral command?
I believe that the meaning of that phrase is that one cannon 'legislatively force' another to do what is right--that is, one cannot legislate 'positive' morality.
However, 'negative' legislation re-inforces common moral law, as you state.