Apple CEO Tim Cook is giving hundreds of millions of dollars to charity.

Cook, who is close to becoming a billionaire, says he will pay for his nephew's college education, then donate the rest of his wealth to philanthropic projects, according to Fortune.

Cook isn't the first top executive to give his money away.

Warren Buffett and Bill Gates launched The Giving Pledge in 2010 -- a campaign to persuade billionaires to give at least half of their fortunes to charity. More than a hundred have signed up so far, including Michael Bloomberg and Facebook (FB)'s Mark Zuckerberg.

Others, like Cook, are going their own way. Last year, Alibaba (BABA) co-founder Jack Ma started a multi-billion dollar charity.

Cook certainly has plenty of funds to give away. His pay at Apple (AAPL) more than doubled last year to $9.2 million, according to a regulatory filing. In 2014, $145 million worth of stock awards vested, and he's got another $536 million in stock awards to come.

Related: Tim Cook: Privacy is a matter of 'life and death'

Cook, who came out last year, also told Fortune that he felt his sexuality was a "yawner," especially internally at Apple.

He remains the only publicly gay CEO in the 700 largest corporations. John Brown served as CEO of BP from 1995 to 2007, but only acknowledged he was gay after he was forced to leave office when a former boyfriend outed him.

Cook took the reins at Apple in 2011 after Steve Jobs resigned.