The command line tool "rosmsg" provides the information you seem to need.
"rosmsg package PKGNAME" outputs a list of messages for a specific package.
"rosmsg show MSGNAME" than outputs the message definition.
But the console tools might actually not be what you want to invoke from within CMake.
From withing CMake only the path of the directories where the message files are location can be accessed.
A package does not expose a list of actual messages.
To access these information you would need to include a specific CMake file generated and only used inside of genmsg. (But be aware that globbing the files might catch messages files which are never getting installed.)
find_package(catkin REQUIRED COMPONENTS std_msgs)
include("${std_msgs_DIR}/std_msgs-msg-paths.cmake"})
# std_msgs_MSG_INCLUDE_DIRS lists all folders from where messages (and services) of that package are located
Probably it is not desired to make the typekit generator a normal message generator since that would generate and embed the generated code into each and every message package and requires the message_generation package to depend on the typekit generator.
Probably the best way would be if every message package (after find_package()-ing) exposes a variable pointing to all available message files.
That should be pretty easy to generate in genmsg using a CMake config extra files.
What exactly is happening, are you iterating over messages in specific packages on demand or should this behave more like a message generator which gets invoked each time a package which contains messages is built?
It might be suitable to be turned into a message generator, but you might not want it to happen for every package. Is there any documentation on writing custom message generators?
I'm not sure about that, but I would expect that there is not, @Dirk Thomas can probably say one way or the other.