How to create a new genesis block using CreateGenesisBlock() function
The genesis block still must meet the proof of work requirements that other blocks must also meet. So you must actually mine the genesis block. To do this, you need to put CreateGenesisBlock in a while loop and just keep incrementing the nonce, and if necessary, increment an extranonce in the coinbase transaction.

To check that it has a valid proof of work, use the CheckProofOfWork() function (grep for it and you can figure out what arguments it takes).