Improve libstd++ handling
clang and icc use libstdc++ under Linux by default.
Previously such dependencies were handled differently than other
dependencies, in that we relied on the compiler autodetection, and
required the user to use the compiler flags to specify a proper
version.
Now we discover libstdc++ using cmake by finding g++, unless the user
or the toolchain they chose have already managed which gcc toolchain
to use. Then the found version is provided to the compiler with the
proper flags.
This has the advantages:
- Makes it easy for us to check the required version is used.
Version check for libstdc++ 5 for C++14 is added.
- Makes it easy for the user to provide the correct version
because standard cmake variables work.
- Makes build reproducible because the instance of libstdc++ used
is constant (e.g. cached via GMX_GPLUSPLUS_PATH, or controlled
by the toolchain, but not if the user chose non-reproducibility
by setting CXXFLAGS environment variables). Previously, the
auto-detection depended on the PATH environment variable at
the time of build (not the time of the cmake run). Thus
rebuilding with the same cache file was not guranteed to
give the same result. It could cause cause confusing link
errors if parts were rebuilt differently.
Also managed libc++ for clang-analyzer builds a bit better.
Fixes #2842
Change-Id: I855e16a6d4bd670cfb7acd6ea5c740f3a1b226bf