Warn and skip multiple custom commands for the same output (#14446)

In buggy code like

 add_custom_command(
   OUTPUT  ${CMAKE_CURRENT_BINARY_DIR}/out.h
   MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/out.h.in
   ...)
 add_custom_command(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/out.h
   ...)

that has more than one rule to generate the same output CMake has always
used the first rule.  However, since commit 2268c41a (Optimize custom
command full-path dependency lookup, 2013-08-06) we update the map from
output to cmSourceFile for every rule generating an output, effectively
keeping the last command instead of the first.

Fix this regression by checking for each map update if the output
already has an entry.  If so, keep only the original entry.  Also
generate a warning to help authors track down such cases and fix their
projects.
Merge topic 'fix-duplicate-custom-commands' into next

68bfed6 Warn and skip multiple custom commands for the same output (#14446)