add_library: Restore error on alias of non-global imported target
In !1264 (merged) we accidentally dropped the error on calling
add_library
to alias an imported target that is not globally visible.
The add_executable
command's equivalent check was properly updated.
Restore the check in add_library
with the same update. Also fix the
test case accordingly.
Fixes: #17982 (closed)