cmake: Future-proof --find-package mode.
Create cmGeneratorTargets before generating generate-time information. C++ interfaces for querying build information is increasingly only available at generate time through the cmGeneratorTarget class. Ensure that the required cmGeneratorTarget instances are created. Use the cmGlobalGenerator access API to access the relevant cmGeneratorTarget instead of creating a temporary one on the stack.