cmGeneratorTarget: Compute the object directory early.

Ensure it is populated before tracing dependencies.
cmTarget: Use GetSourceFiles for languages.
cmTarget: Rename AddSource method for backward compatibility.

Add a new AddSource method for future use.
cmSourceFileLocation: Make copyable and assignable.

This allows using it in containers and algorithms.
cmTarget: Add a method to obtain list of filenames for sources.
cmTarget: Use string API to add sources to cmTarget objects.

Continue to call GetOrCreateSource where necessary to create
cmSourceFile objects which have the GENERATED attribute set.
cmTarget: Remove AddSourceFile method

It is no longer used.
cmSourceFileLocation: Normalize compared directories.

Otherwise Matches() ends up doing a comparison of
the directories

 /path/to/dir/subdir/..

and

 /path/to/dir

as strings and not matching where it should.
cmTarget: Store strings instead of cmSourceFile* to represent SOURCES.

This will allow the strings to contain generator expressions.

At this point, generator expressions are still not part of the
SOURCES property when it is read.
Genex: Evaluate TARGET_OBJECTS as a normal expression.
cmStringCommand: Add GENEX_STRIP subcommand.

Strip out any generator expressions in the input string.
cmGlobalGenerator: Add interface to call ForceLinkerLanguages

Avoid calling it too early when cmGeneratorTarget instances don't
yet exist.
cmTarget: Include TARGET_OBJECTS genex in target SOURCES property.

Add policy CMP0051 to control this behavior.
cmTarget: Allow any generator expression in SOURCES property.

Remove use of UseObjectLibraries from Makefile and Ninja generators. It
is not needed now because those generators use GetExternalObjects
which already contains the objects from object libraries.

The VS10 generator calls both the UseObjectLibraries and the GetExternalObjects
methods. Ensure that duplicates are not created by skipping objects
from object libraries in handling of GetExternalObjects.

Similarly, fix Xcode object handling by skipping external objects from
OBJECT_LIBRARY usage as appropriate.

The error message in the BadSourceExpression1 test is now reported
by the generator expression evaluator, so it has different text.
cmComputeTargetDepends: Track object library depends.

Relieve cmGeneratorTarget of that responsibility.
cmGeneratorTarget: Compute consumed object libraries on demand.

Remove up-front object library computation from cmGlobalGenerator.

Adjust tests for message coming from the generator expression
evaluation.
cmTarget: Compute languages from object libraries on demand.
cmGeneratorTarget: Compute target objects on demand

Add a ComputeObjectMapping method to compute the object
names.  It takes mapping to populate as an out-parameter so
that it can be extended in the future with parameters
relevant to generator expression evaluation.

Remove the supporting cmGeneratorTarget::AddObject method. It is
no longer needed as the container member is populated directly.

The ComputeObjectMapping method is called whenever objects are
requested from the cmGeneratorTarget.  Because the Xcode generator
makes no such request, explicitly invoke the method from that
generator so that the logic of checking for bad sources in object
libraries is executed.

In a follow-up, the UseObjectLibraries usage may be replaced by a
true generator expression evaluator for TARGET_OBJECTS. That
will require generators to use cmGeneratorTarget::GetExternalObjects
which is not currently the case for Xcode and VS generators.
Genex: Only evaluate TARGET_OBJECTS to determine target sources.

The output of this expression may contain macros for IDEs to replace
such as $(Configuration), $(CURRENT_ARCH) etc.  To avoid generating
content which is not usable in other contexts, report an error if
there is an attempt to use it in other contexts.

This commit may be reverted in the future if a solution to the
above difference is implemented.
Merge topic 'target-sources-refactor' into next

85f04db4 Genex: Only evaluate TARGET_OBJECTS to determine target sources.
71c9d41d cmGeneratorTarget: Compute target objects on demand
a0ff5319 cmTarget: Compute languages from object libraries on demand.
34a9e352 cmGeneratorTarget: Compute consumed object libraries on demand.
19477655 cmComputeTargetDepends: Track object library depends.
101ea5dd cmTarget: Allow any generator expression in SOURCES property.
387170bd cmTarget: Include TARGET_OBJECTS genex in target SOURCES property.
40599425 cmGlobalGenerator: Add interface to call ForceLinkerLanguages
15b7247f cmStringCommand: Add GENEX_STRIP subcommand.
c3d087f0 Genex: Evaluate TARGET_OBJECTS as a normal expression.
0a41b247 cmTarget: Store strings instead of cmSourceFile* to represent SOURCES.
d0e55aba cmSourceFileLocation: Normalize compared directories.
c015bb91 cmTarget: Remove AddSourceFile method
92e7fce8 cmTarget: Use string API to add sources to cmTarget objects.
6e8dbd6f cmTarget: Add a method to obtain list of filenames for sources.
c4b1887a cmSourceFileLocation: Make copyable and assignable.
...