GHS choosing target architecture and platform is clumsy

After using the Green Hills MULTI generator for a while I find setting up the build a bit clumsy and inconsistent.

In the build files themselves there is a field called primaryTarget which tells the build system what compilers and settings will be used for cross-compiling.

Some examples:
arm_integrity.tgt is for using the Integrity OS for 32 bit ARM.
arm_integrity64.tgt is for using the Integrity OS for 64 bit ARM.
ppc_integrity.tgt is for PowerPC Integrity OS
86_linux.tgt is for x86 Linux targets

Today the primaryTarget gets set from a user defined cache variable GHS_PRIMARY_TARGET.
If the user didn’t set it then its pieced together from <CMAKE_GENERATOR_PLATFORM>_<GHS_TARGET_PLATFORM>.tgt. These variables if not user specified defaulted such that the primaryTarget would be 'arm_integrity.tgt`.

The part I find clumsy is that the only use that -A has is setting CMAKE_GENERATOR_PLATFORM but that has no meaning if GHS_PRIMARY_TARGET was set.

Because of the way the generator morphed over time from always assuming ARM you can find yourself in a situation of CMAKE_GENERATOR_PLATFORM equaling arm but primaryTarget equaling ppc_integrity.tgt. So the actual target architecture is PowerPC.

For simplicity’s sake I’d like to just run cmake -A ppc_integrity.tgt and not worry about the way its being done today and just get rid of some of these GHS specific variables. But that leads to a backwards compatibility issue with previous CMake versions.

For reference, GHS support is fully developed and maintained by contributors. Upstream CMake developers have no access or experience with the platform or its tooling.

I’m working on a set of patches that cleans this up but maintains backwards compatibility. It also takes into account using the GHS compilers with the Ninja generator.