install: Do not crash on imported global target

Since commit e89ad0f9 (install: Allow installing targets created in
another directory, 2018-06-18, v3.13.0-rc1~407^2) the `install(TARGETS)`
command may find a global-scoped target outside the calling directory.
Ignore an `IMPORTED GLOBAL` target if it is found in this way.  Imported
targets cannot be installed, and trying to do so violates internal
invariants.

Fixes: #19022
45 jobs for <span class="ref-name">install-no-imported-global</span>
Status Job ID Name Coverage
  External
passed cdash

passed cmake-dash3win7-windows-release-ninja

passed cmake-hythloth-linux-debug-makefiles+sphinx

passed cmake-minoc-linux-release-lint-iwyu-tidy

passed cmake-moonshade-osx-debug-ninja

passed cmake-moonshade-osx-release-makefiles

passed cmake-terfin-windows-release-vs2017

passed ghostflow-check-master

passed ghostflow-stager

passed cmake-dash3win7-windows-release-ninja

passed cmake-dash3win7-windows-release-ninja

passed cmake-dash3win7-windows-release-ninja

passed cmake-dash3win7-windows-release-ninja

00:30:38

passed cmake-hythloth-linux-debug-makefiles+sphinx

passed cmake-hythloth-linux-debug-makefiles+sphinx

01:03:24

passed cmake-hythloth-linux-debug-makefiles+sphinx

passed cmake-hythloth-linux-debug-makefiles+sphinx

passed cmake-minoc-linux-release-lint-iwyu-tidy

passed cmake-minoc-linux-release-lint-iwyu-tidy

passed cmake-minoc-linux-release-lint-iwyu-tidy

00:11:51

passed cmake-minoc-linux-release-lint-iwyu-tidy

passed cmake-moonshade-osx-debug-ninja

passed cmake-moonshade-osx-debug-ninja

passed cmake-moonshade-osx-debug-ninja

00:16:43

passed cmake-moonshade-osx-debug-ninja

passed cmake-moonshade-osx-release-makefiles

passed cmake-moonshade-osx-release-makefiles

passed cmake-moonshade-osx-release-makefiles

00:14:29

passed cmake-moonshade-osx-release-makefiles

passed cmake-terfin-windows-release-vs2017

passed cmake-terfin-windows-release-vs2017

passed cmake-terfin-windows-release-vs2017

01:09:56

passed cmake-terfin-windows-release-vs2017

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager