CCC 1755 A morally good act requires the goodness of the object, of the end, and of the circumstances together. An evil end corrupts the action, even if the object is good in itself (such as praying and fasting “in order to be seen by men”).
The object of the choice can by itself vitiate an act in its entirety. There are some concrete acts – such as fornication – that it is always wrong to choose, because choosing them entails a disorder of the will, that is, a moral evil.

CCC 1756 It is therefore an error to judge the morality of human acts by considering only the intention that inspires them or the circumstances (environment, social pressure, duress or emergency, etc.) which supply their context. There are acts which, in and of themselves, independently of circumstances and intentions, are always gravely illicit by reason of their object; such as blasphemy and perjury, murder and adultery. One may not do evil so that good may result from it.