Allow toolchain files to specify an external toolchain.

Clang can compile code, but uses the gcc tools for other tasks such
as linking. The -gcc-toolchain option can be used for that, but
generalize so that other compilers can be treated the same.

If such a location is specified, use it as a hint for finding
the binutils executables.
Only look in the host for internal CMake file.

A toolchain file will generally contain the following lines:

 set(CMAKE_SYSROOT /path/to/sysroot)
 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

The find_file in Modules/CMakeDetermineCompilerId.cmake should not
look in the sysroot or the CMAKE_FIND_ROOT_PATH entries, so
add the parameter to control that in CMakeDetermineCompilerId.cmake.
Use --sysroot when cross compiling.

As CMAKE_ROOT_FIND_PATH can be a list, a new CMAKE_SYSROOT is
introduced, which is never a list.

The contents of this variable is passed to supporting compilers
as --sysroot. It is also accounted for when processing implicit
link directories reported by the compiler, and when generating
RPATH information.
Introduce CMAKE_STAGING_PREFIX variable.

This variable can be useful in cross-compiling contexts where the
sysroot is read-only or where the sysroot should otherwise remain
pristine.

If the new CMAKE_STAGING_PREFIX variable is set, it is used instead
of CMAKE_INSTALL_PREFIX when generating the installation rules in
cmake_install.cmake.

This way, the CMAKE_INSTALL_PREFIX variable
always refers to the installation prefix on the target device, regardless
of whether host==target.

If any -rpath paths passed to the linker contain the CMAKE_STAGING_PREFIX,
the matching path fragments are replaced with the CMAKE_INSTALL_PREFIX.
Matching paths in the -rpath-link are not transformed.

The cross-prefix usr-move workaround is assumed not to require extension
regarding CMAKE_STAGING_PREFIX. The staging area is a single prefix, so
there is no scope for cross-prefix symlinks. The CMAKE_INSTALL_PREFIX
is still used to determine the workaround path, and that variable
remains the relevant one even if CMAKE_STAGING_PREFIX is used. If the
generated export files are deployed to the target, the workaround
will still be in place, and still be employed if required.
Add tests
Test installation to stage.
Fix path quoting.
Add error diagnosis.
Fix libz.so.
Diagnose bug.

Presumably the dashboard machine does not use triples in the lib directories.
Clear triple if not used.
Can't expect shortened libs.
shot in the dark.
Remove tests.
Merge topic 'cross-compiling-toolchain-variables' into next

578aa85 Remove tests.
189568d shot in the dark.
d48d799 Can't expect shortened libs.
8a51819 Clear triple if not used.
96dbe19 Diagnose bug.
f09e956 Fix libz.so.
0cfd94a Add error diagnosis.
af4f1c9 Fix path quoting.
ceabec2 Test installation to stage.
0d1b80d Add tests
0f0f75c Introduce CMAKE_STAGING_PREFIX variable.
6d32e61 Use --sysroot when cross compiling.
fc66bf8 Only look in the host for internal CMake file.
3a75bf0 Allow toolchain files to specify an external toolchain.
Introduce CMAKE_STAGING_PREFIX variable.

This variable can be useful in cross-compiling contexts where the
sysroot is read-only or where the sysroot should otherwise remain
pristine.

If the new CMAKE_STAGING_PREFIX variable is set, it is used instead
of CMAKE_INSTALL_PREFIX when generating the installation rules in
cmake_install.cmake.

This way, the CMAKE_INSTALL_PREFIX variable
always refers to the installation prefix on the target device, regardless
of whether host==target.

If any -rpath paths passed to the linker contain the CMAKE_STAGING_PREFIX,
the matching path fragments are replaced with the CMAKE_INSTALL_PREFIX.
Matching paths in the -rpath-link are not transformed.

The cross-prefix usr-move workaround is assumed not to require extension
regarding CMAKE_STAGING_PREFIX. The staging area is a single prefix, so
there is no scope for cross-prefix symlinks. The CMAKE_INSTALL_PREFIX
is still used to determine the workaround path, and that variable
remains the relevant one even if CMAKE_STAGING_PREFIX is used. If the
generated export files are deployed to the target, the workaround
will still be in place, and still be employed if required.
Merge topic 'cross-compiling-toolchain-variables' into next

32d606c Introduce CMAKE_STAGING_PREFIX variable.
Add missing files.
Merge topic 'autogen-depends' into next

83c5c66 Add missing files.
cmQtAutogen: Allow specifying depends for autogen targets.

Test this by generating files with a custom target, which require
processing by automoc.

Lift the restriction of automoc on processing generated files. Instead,
mark the generated _automoc file as skipped for automoc purposes.