avoid invoking genmsg extras multiple time

I noticed that the code in genmsg-extras.cmake is invoked multiple times in the same catkin build. Maybe that's intentional to remain flexible, but seems like a waste of timeto me.

The current if() block at the top only prevents it from being invoked from the same subdirectory/scope. So this is just a small optimisation (could be premature optimisation).