Ninja: Query custom commands once per target, not once per file.

Computing the source files is now more expensive, so the Ninja
generator became very slow with a large number of files.
cmTarget: Extract a ProcessSourceItemCMP0049 method.

Avoid calling AddSource for each src filename.  That involves
checking each entry for uniqueness and creating a separate
generator expression for each one.

Instead, add a single entry for the list of sources.  The source
files are passed through a uniqueness filter at generate-time, so
duplicates don't matter so much.
cmTarget: Cache the cmSourceFiles in GetSourceFiles.

Avoid calling GetSourceFiles with the same result container multiple
times when tracing target dependencies.  The result from the previous
configuration is cached and used later otherwise.
cmGeneratorTarget: Trace cmSourceFile objects instead of strings.

This reverses the decision in commit d38423ec (cmTarget: Add a
method to obtain list of filenames for sources., 2014-03-17).  The
cmSourceFile based API is preferred because that avoids creation of
many cmSourceFileLocation objects for matching strings, and the
result is cached by cmTarget.
cmTarget: Make GetSourceFiles string overload private.

Consumers should use the cmSourceFile overload, which is now
always the case.
Merge topic 'optimize-source-file-processing' into next

9bc502b4 cmTarget: Make GetSourceFiles string overload private.
6049606c cmGeneratorTarget: Trace cmSourceFile objects instead of strings.
fa733831 cmTarget: Cache the cmSourceFiles in GetSourceFiles.
d6bf82cf cmTarget: Extract a ProcessSourceItemCMP0049 method.
19b7c22d Ninja: Query custom commands once per target, not once per file.