On posix platforms return values are limited to a range from 0 to 255.
Cross compiling/linking with MSVC on linux/wine leads to a
misinterpretation of the return value 1090650113 of mt.exe.
Do not access an argument index not known to exist.
Port the change from commit 9ef66f2b (cmake: Validate -E cmake_automoc
argument count, 2013-11-05) to the new location of the code.
There is no need for a "cmake_automoc" backward compatibility command
because it is internal, undocumented, and only executed from a matching
version of cmake.
Move the cmake::ExecuteCMakeCommand static method and all the static
methods it calls out of the 'cmake' class to a separate 'cmcmd' class.
Build the latter as part of the main cmake executable with cmakemain.cxx
and not in CMakeLib. Drop unused header includes from "cmake.cxx".
By moving this implementation out of cmake.cxx we avoid carrying it
around in all the executables that use class 'cmake'. It is needed only
for the main "cmake -E" functionality.