Revert topic.
Merge topic 'target-transitive-sources' into next

67afe21f Revert topic.
Fix version in policy.
Merge topic 'target-sources-refactor' into next

daa0b6c4 Fix version in policy.
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 VS6, VS7 and 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.
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.
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.
Merge topic 'target-sources-refactor' into next

5de63265 Genex: Only evaluate TARGET_OBJECTS to determine target sources.
aa0a3562 cmGeneratorTarget: Compute target objects on demand
042c1c83 cmTarget: Compute languages from object libraries on demand.
fdcefe3c cmGeneratorTarget: Compute consumed object libraries on demand.
c355d108 cmComputeTargetDepends: Track object library depends.
e5da9e51 cmTarget: Allow any generator expression in SOURCES property.
5702e106 cmTarget: Include TARGET_OBJECTS genex in target SOURCES property.
cmComputeTargetDepends: Use valid config to compute target depends.

If CMAKE_BUILD_TYPE is set, and user code contains:

 target_link_libraries(myexe prefix_$<$<CONFIG:Debug>:debug>)

then the computation with an empty config was computing a target-level
dependency on a target or library called prefix_, and a dependency
on a target or library called prefix_debug (as expected).

The existing logic skips 'prefix_' because it is not a known target,
and defers to the link-dependencies logic to find the library. The
link-dependencies logic does not incorrectly handle the config as
cmComputeTargetDepends did, and so did not encounter 'prefix_'
during its computation. This likely had no effect on the generated
buildsystem.
cmGeneratorTarget: Don't add computed sources to the target.

When config-specifig generator expressions are supported, a target
may have SOURCES:

 src1.cpp $<$<CONFIG:Debug>:src2.cpp> $<$<CONFIG:Release>:src3.cpp>

and computation in cmTargetTraceDependencies would add each of the
src2.cpp and src3.cpp sources back to the target without a
config-guard.  That would make the sources be used later when
generating the buildsystem, regardless of the configuration.

Avoid calling AddSource on the target with the result of the
GetSourceFiles call.
cmTarget: Make the source files depend on the config.

Disallow the use of config-specific source files with
the Visual Studio and Xcode generators. They don't have
any way to represent the condition currently.

Use the same common-config API in cmQtAutoGenerators. While
it accepts config-specific files, it doesn't have to support
multiple configurations yet.

Loop over the configs in cmTargetTraceDependencies
and cmGlobalGenerator::WriteSummary and consume all source
files.

Loop over the configs in cmComputeTargetDepends and compute the
object library dependencies for each config.
cmTarget: Allow transitive evaluation of SOURCES property.

Extend the cmGeneratorExpressionDAGChecker with an interface
returning the name of the top target.  Use that to determine
when there is a DAG violation, as required by the RunCMake.Languages
tests.
cmTarget: Make the SOURCES origin tracable.
Make the SOURCES target property writable.
target_sources: New command to add sources to target.
Merge topic 'target-transitive-sources' into next

9407174b target_sources: New command to add sources to target.
81ad69e0 Make the SOURCES target property writable.
6e636f2e cmTarget: Make the SOURCES origin tracable.
3676fb49 cmTarget: Allow transitive evaluation of SOURCES property.
e6971df6 cmTarget: Make the source files depend on the config.
df753df9 cmGeneratorTarget: Don't add computed sources to the target.
869328aa cmComputeTargetDepends: Use valid config to compute target depends.