Looking at the second part of your examples, it looks like that only the first is correct here. This is called the third conditional, which is used when an action didn't happen in the past and you want to express your thoughts about the possible outcome of the action had it happened.
In the first you are saying that you didn't know if she was coming, so you didn't bake a cake for him/her. Now, you can tell this to your loved one when she turns up at your door unexpectedly and you feel like you want to serve her cake.
The third would be okay, but the present form makes it a bit awkward. So it's better to avoid that usage.