Add USES_TERMINAL option for custom commands

Teach the add_custom_command and add_custom_target commands a new
USES_TERMINAL option.  Use it to tell the generator to give the command
direct access to the terminal if possible.
Give the interactive cache editor the USES_TERMINAL property
Ninja: factor out the test for console pool support
Ninja: Remove unused declaration
Ninja: Implement USES_TERMINAL using the console pool if available
Help: Add notes for topic 'console-pool'
KWSys SharedForward: Hard-code the ldpath buffer size to below VS 14 limit

Visual Studio 14 (2015) complains if a static character array is
declared with more than 65535 elements.  This limit should be large
enough for SharedForward clients, so just hard-code that instead of
trying to compute a limit.
Tests/BuildDepends: Drop unneeded help for Ninja

The extra post-modification invocations of 'ninja' does not seem to be
needed anymore for the BuildDepends test to pass.
Ninja: Use a TARGET_FILE variable to hold the link output file

Use an explicit "$TARGET_FILE" variable instead of "$out" so that
we can have multiple output files while still only referencing the
main one in command lines.
Ninja: Refactor restat to be a string internally

This will allow values other than "" and "1" to be generated in
the rules.ninja file.
Add an option for explicit BYPRODUCTS of custom commands (#14963)

A common idiom in CMake-based build systems is to have custom commands
that generate files not listed explicitly as outputs so that these
files do not have to be newer than the inputs.  The file modification
times of such "byproducts" are updated only when their content changes.
Then other build rules can depend on the byproducts explicitly so that
their dependents rebuild when the content of the original byproducts
really does change.

This "undeclared byproduct" approach is necessary for Makefile, VS, and
Xcode build tools because if a byproduct were listed as an output of a
rule then the rule would always rerun when the input is newer than the
byproduct but the byproduct may never be updated.

Ninja solves this problem by offering a 'restat' feature to check
whether an output was really modified after running a rule and tracking
the fact that it is up to date separately from its timestamp.  However,
Ninja also stats all dependencies up front and will only restat files
that are listed as outputs of rules with the 'restat' option enabled.
Therefore an undeclared byproduct that does not exist at the start of
the build will be considered missing and the build will fail even if
other dependencies would cause the byproduct to be available before its
dependents build.

CMake works around this limitation by adding 'phony' build rules for
custom command dependencies in the build tree that do not have any
explicit specification of what produces them.  This is not optimal
because it prevents Ninja from reporting an error when an input to a
rule really is missing.  A better approach is to allow projects to
explicitly specify the byproducts of their custom commands so that no
phony rules are needed for them.  In order to work with the non-Ninja
generators, the byproducts must be known separately from the outputs.

Add a new "BYPRODUCTS" option to the add_custom_command and
add_custom_target commands to specify byproducts explicitly.  Teach the
Ninja generator to specify byproducts as outputs of the custom commands.
In the case of POST_BUILD, PRE_LINK, and PRE_BUILD events on targets
that link, the byproducts must be specified as outputs of the link rule
that runs the commands.  Activate 'restat' for such rules so that Ninja
knows it needs to check the byproducts, but not for link rules that have
no byproducts.
CMake Nightly Date Stamp
CMake Nightly Date Stamp
CMake Nightly Date Stamp
ExternalProject: Add options to specify BYPRODUCTS (#14963)

The external project's build process may generate byproducts on which
other rules in the driving project's build later depend.  Provide a way
for the driving project to specify what byproducts it expects to be made
available by the custom commands that drive the external project.
Merge topic 'custom-command-byproducts' into next

557aef0b ExternalProject: Add options to specify BYPRODUCTS (#14963)
e15a7075 Add an option for explicit BYPRODUCTS of custom commands (#14963)
67bd514a Ninja: Refactor restat to be a string internally
ef42e57d Ninja: Use a TARGET_FILE variable to hold the link output file
592644c4 Tests/BuildDepends: Drop unneeded help for Ninja
2d75d7e5 Help: Add notes for topic 'console-pool'
f42d86f0 Ninja: Implement USES_TERMINAL using the console pool if available
f281ae01 Ninja: Remove unused declaration
d5eae556 Ninja: factor out the test for console pool support
4d1fedf4 Give the interactive cache editor the USES_TERMINAL property
fe5d6e8c Add USES_TERMINAL option for custom commands
Merge topic 'string-SUBSTRING-truncate'

474bbb9d string: Tolerate SUBSTRING length exceeding end index
Merge topic 'CPackRPM_SUBSTRING_-1'

5cc8169b CPackRPM: remove unneeded string length calculation
Merge topic 'fix-vs2015-warnings'

b138be07 cmVisualStudio10TargetGenerator: fix a narrowing warning
8d379cd7 cmCallVisualStudioMacro: fix a shadowing warning
Merge topic 'vs14-is-2015'

f5afb90d VS: Rename VS 14 generator to 'Visual Studio 14 2015'