cmake: Validate -E cmake_automoc argument count (#14545)

Do not access an argument index not known to exist.
Merge branch 'cmake-E-automoc-crash' into cmake-E-autogen-crash
cmake: Validate -E cmake_autogen argument count (#14545)

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.
Merge topic 'cmake-E-autogen-crash' into next

132c40a cmake: Validate -E cmake_autogen argument count (#14545)
cc52b7d Merge branch 'cmake-E-automoc-crash' into cmake-E-autogen-crash
9ef66f2 cmake: Validate -E cmake_automoc argument count (#14545)