The native runtime is subdivided into a collection of static libraries,
linked into the target shared library based on a set of conditions.
Some static libraries are "private" and aren't copied to packages, but
some are "public" in that they can be shipped in our nugets (when
dynamic runtime linking at app build time is implemented). At the same
time, we have several build configurations which differ in their build
and link configurations, and especially in whether or not they link
against the shared C++ standard library or not. In particular, the ASAN
and UBSAN builds require enabling of exceptions, RTTI and linking
against the shared C++ library.
Static component libraries will be built with the same set of
compilation and linking flags, and without modifying their output names
in some way, they may result in linking errors similar to:
```
native failed with 25 error(s) (0.6s) →
ld.lld : error : undefined symbol: std::logic_error::logic_error(char const*)
clang++ : error : linker command failed with exit code 1 (use -v to see invocation)
ld.lld : error : undefined symbol: __gxx_personality_v0
ld.lld : error : undefined symbol: __cxa_begin_catch
ld.lld : error : undefined symbol: std::__ndk1::mutex::lock()
ld.lld : error : undefined symbol: std::__ndk1::mutex::unlock()
ld.lld : error : undefined symbol: __cxa_end_cleanup
```
This kind of errors may not show during the very first build of the
repository, but it will show on any subsequent build since the static
component library name used by **all** the configurations is the same,
but the compilation and linking flags are different. If, e.g., UBSAN
build follows the standard build, it will replace the previously built
library with its own version but different linking requirements.
Subsequent build of non-UBSAN version of library will try to use the
static component library built with UBSAN flags, resulting in the
linking error above.
In order to avoid this kind of confusion but also minimize the number of
branches in CMake script files, this commit simply makes sure that all
the relevant static component libraries use an optional suffix when
generating their output. By default the suffix is empty, resulting in
e.g. `libruntime-base.a`, but with UBSAN enabled, it will produce
`libruntime-base-ubsan.a` thus making sure the builds don't step on each
other's toes.