Simplify logic.
Merge topic 'optimize-source-file-processing' into next

74a21d55 Simplify logic.
cmTarget: Short-circuit language computation if context independent.

Computing the language involves computing the source files, which
is an expensive operation.  It requires calling
cmMakefile::GetOrCreateSource many times, which involves creating
and matching on many cmSourceFileLocation objects.

Source files of a target may depend on the head-target and the
config as of commit e6971df6 (cmTarget: Make the source files depend
on the config., 2014-02-13).  The results are cached for each context
as of commit c5b26f3b (cmTarget: Cache the cmSourceFiles in
GetSourceFiles., 2014-04-05).

Each target in the build graph causes language computation of all
of its dependents with itself as the head-target.  This means that
for 'core' libraries on which everything depends, the source files
are computed once for every transitive target-level-dependee and
the result is not cached because the head-target is different. This
was observed in the VTK buildsystem.

Short circuit the computation for targets which have a source-list
that is independent of the head-target.  If the source-list has
already been computed and the generator expression evaluation
reports that it was context-independent, return the only source-list
already cached for the target.  Reset the short-circuit logic when
sources are added and when the link libraries are re-computed.
cmTarget: Add all sources traced from custom commands at once.

The AddSource method accepts one file and tries to avoiding adding
it to the sources-list of the target if it already exists.  This
involves creating many cmSourceFileLocation objects for matching
on existing files, which is an expensive operation.

Avoid the searching algorithm by appending the new sources as one
group.  Generate-time processing of source files will ensure
uniqueness.

Add a new AddTracedSources for this purpose.  The existing
AddSources method must process the input for policy CMP0049, but
as these source filenames come from cmSourceFile::GetFullPath(),
we can forego that extra processing.
Merge topic 'optimize-source-file-processing' into next

4f1c71fd cmTarget: Add all sources traced from custom commands at once.
b1c3ae33 cmTarget: Short-circuit language computation if context independent.
Export: Disallow exported interface includes in src/build tree (#14592).

Allow directories in the source tree or build tree only if the
install tree is a subdirectory of the source tree or build tree,
as appropriate.

Re-use the test files in the RunCMake.include_directories test
to run in multiple scenarios.  Bump the required CMake version
in the test to 3.0 to ensure that the new policy warnings are
emitted correctly.
Merge topic 'install-prefix-in-interface' into next

783bce29 Export: Disallow exported interface includes in src/build tree (#14592).