The Catholic Church has had a strong position against masturbation and against lusting (carnal desires) for a very long time.
Let me share with you the Catholic Catechism here.
http://www.vatican.va/archive/ccc_css/archive/catechism/p3s2c2a6.htm
"Offenses against chastity
2351 Lust is disordered desire for or inordinate enjoyment of sexual pleasure. Sexual pleasure is morally disordered when sought for itself, isolated from its procreative and unitive purposes.
2352 By masturbation is to be understood the deliberate stimulation of the genital organs in order to derive sexual pleasure. "Both the Magisterium of the Church, in the course of a constant tradition, and the moral sense of the faithful have been in no doubt and have firmly maintained that masturbation is an intrinsically and gravely disordered action."138 "The deliberate use of the sexual faculty, for whatever reason, outside of marriage is essentially contrary to its purpose." For here sexual pleasure is sought outside of "the sexual relationship which is demanded by the moral order and in which the total meaning of mutual self-giving and human procreation in the context of true love is achieved."139
To form an equitable judgment about the subjects' moral responsibility and to guide pastoral action, one must take into account the affective immaturity, force of acquired habit, conditions of anxiety or other psychological or social factors that lessen, if not even reduce to a minimum, moral culpability.
2353 Fornication is carnal union between an unmarried man and an unmarried woman. It is gravely contrary to the dignity of persons and of human sexuality which is naturally ordered to the good of spouses and the generation and education of children. Moreover, it is a grave scandal when there is corruption of the young.
2354 Pornography consists in removing real or simulated sexual acts from the intimacy of the partners, in order to display them deliberately to third parties. It offends against chastity because it perverts the conjugal act, the intimate giving of spouses to each other. It does grave injury to the dignity of its participants (actors, vendors, the public), since each one becomes an object of base pleasure and illicit profit for others. It immerses all who are involved in the illusion of a fantasy world. It is a grave offense. Civil authorities should prevent the production and distribution of pornographic materials.
2355 Prostitution does injury to the dignity of the person who engages in it, reducing the person to an instrument of sexual pleasure. The one who pays sins gravely against himself: he violates the chastity to which his Baptism pledged him and defiles his body, the temple of the Holy Spirit.140 Prostitution is a social scourge. It usually involves women, but also men, children, and adolescents (The latter two cases involve the added sin of scandal.). While it is always gravely sinful to engage in prostitution, the imputability of the offense can be attenuated by destitution, blackmail, or social pressure.
2356 Rape is the forcible violation of the sexual intimacy of another person. It does injury to justice and charity. Rape deeply wounds the respect, freedom, and physical and moral integrity to which every person has a right. It causes grave damage that can mark the victim for life. It is always an intrinsically evil act. Graver still is the rape of children committed by parents (incest) or those responsible for the education of the children entrusted to them. "
…
IN BRIEF
2392 "Love is the fundamental and innate vocation of every human being" (FC 11).
2393 By creating the human being man and woman, God gives personal dignity equally to the one and the other. Each of them, man and woman, should acknowledge and accept his sexual identity.
2394 Christ is the model of chastity. Every baptized person is called to lead a chaste life, each according to his particular state of life.
2395 Chastity means the integration of sexuality within the person. It includes an apprenticeship in self-mastery.
2396 Among the sins gravely contrary to chastity are masturbation, fornication, pornography, and homosexual practices.
2397 The covenant which spouses have freely entered into entails faithful love. It imposes on them the obligation to keep their marriage indissoluble.
2398 Fecundity is a good, a gift and an end of marriage. By giving life, spouses participate in God's fatherhood.
2399 The regulation of births represents one of the aspects of responsible fatherhood and motherhood. Legitimate intentions on the part of the spouses do not justify recourse to morally unacceptable means (for example, direct sterilization or contraception).
2400 Adultery, divorce, polygamy, and free union are grave offenses against the dignity of marriage. "