Idea here is to avoid potentially confusing errors if cross compiling and forgetting to set the MPGEN_EXECUTABLE.
Idea came from theuni in https://github.com/bitcoin/bitcoin/pull/31741#discussion_r2040214663 with suggestion to show a warning whenever CMAKE_CROSSCOMPILING was set and MPGEN_EXECUTABLE wasn’t set, but this would show a warning in the default build which excludes tests and examples and does not need to run the code generator. Also it could warn spuriously if cross-compiled binaries were actually executable.
Avoid these problems by using check_cxx_source_runs instead of CMAKE_CROSSCOMPILING to see if binaries can run and triggering an error at build time instead of configure time to avoid showing warnings when code generator is not actually needed.
This is currently a draft PR, because I haven’t tested it on a cross-compiled system so not actually sure it is a significant improvement. Also not sure if this is the best approach.