Keep expanding CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG in rules (#13155).

As mentioned in 1a25d0ee point (3), some third party projects might still
depend on rule variables like <CMAKE_SHARED_LIBRARY_SONAME_C_FLAG>. No problem
here since there is absolutely no harm done if we keep expanding it. In case of
<TARGET_SONAME> expansion, it won't happen if NO_SONAME is enabled. However,
that's a new feature which is not enabled by default hence it is rather
reasonable to expect projects to adapt if they want to support it.
Handle -install_name via SONAME_FLAG substitution on OS X (#13155).

Actually, -install_name is already in
CMAKE_SHARED_LIBRARY_SONAME_{C,CXX,FORTRAN}_FLAG on Darwin. Therefore, simply
expand it via <SONAME_FLAG> in the platform files in order to make it NO_SONAME
aware.

What is more, make <TARGET_INSTALLNAME_DIR> NO_SONAME aware as well. Since
-install_name is soname on OS X, this should not be a problem if this variable
is expanded only if soname is enabled.

This commit should address concerns expressed in 1a25d0ee point (2).
Fix NO_SONAME support in Ninja generator (#13155).

As noted in 1a25d0ee point (1), NO_SONAME support for Ninja was broken. Rather
than omitting $SONAME from rules.ninja, simply do not write its contents for
targets which have NO_SONAME. Since 3 variables are affected by NO_SONAME
($SONAME, $SONAME_FLAG, $INSTALLNAME_DIR), set them only if
cmTarget::HasSOName() is enabled.

With the addition of SONAME_FLAG variable handling to Ninja, it makes 3
references to CMAKE_SHARED_LIBRARY_SONAME_<LANG>_FLAG in the code. Therefore,
refactor its expansion to the cmMakefile::GetSONameFlag() method.
Push responsibility for soname flag outside local generator (#13155).

In order to keep cmLocalGenerator::ExpandRuleVariable() more straightforward,
transfer full responsibility of setting SONameFlag to the caller.
Support building shared libraries or modules without soname (#13155)

Add a boolean target property NO_SONAME which may be used to disable
soname for the specified shared library or module even if the platform
supports it.  This property should be useful for private shared
libraries or various plugins which live in private directories and have
not been designed to be found or loaded globally.

Replace references to <CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG> and
hard-coded -install_name flags with a conditional <SONAME_FLAG> which is
expanded to the value of the CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG
definition as long as soname supports is enabled for the target in
question.  Keep expanding CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG in
rules in case third party projects still use it.  Such projects would
not yet use NO_SONAME so the adjacent <TARGET_SONAME> will always be
expanded.  Make <TARGET_INSTALLNAME_DIR> NO_SONAME aware as well.  Since
-install_name is soname on OS X, this should not be a problem if this
variable is expanded only if soname is enabled.

The Ninja generator performs rule variable substitution only once
globally per rule to put its own placeholders.  Final substitution is
performed by ninja at build time.  Therefore we cannot conditionally
replace the soname placeholders on a per-target basis.  Rather than
omitting $SONAME from rules.ninja, simply do not write its contents for
targets which have NO_SONAME.  Since 3 variables are affected by
NO_SONAME ($SONAME, $SONAME_FLAG, $INSTALLNAME_DIR), set them only if
soname is enabled.
Test NO_SONAME property (#13155)

Teach the Plugin test to check that the NO_SONAME target property works
as documented.  Check that the IMPORTED targets are written with the
correct properties.  When readelf is available use it to check the
actual binary files for SONAME fields.
Revert "Revert topic 'module-no-soname' (#13155)"

This reverts commit 1a25d0ee78e0a9ece106c14837b307560b4fb2f2.
Restore the topic so additional commits can be merged for reference.
Fix line-too-long style error
Merge branch 'no-soname' into revive-module-no-soname
Merge topic 'revive-module-no-soname' into next

71f64e7 Merge branch 'no-soname' into revive-module-no-soname
1048701 Fix line-too-long style error
0c0fe7a Revert "Revert topic 'module-no-soname' (#13155)"
fc2605a Push responsibility for soname flag outside local generator (#13155).
91f8288 Fix NO_SONAME support in Ninja generator (#13155).
fa62806 Handle -install_name via SONAME_FLAG substitution on OS X (#13155).
6dbd041 Keep expanding CMAKE_SHARED_LIBRARY_SONAME_${LANG}_FLAG in rules (#13155).
Merge topic 'module-no-soname' into next

fdb3f87 Test NO_SONAME property (#13155)
e1409ac Support building shared libraries or modules without soname (#13155)