Improve libstd++ handling
authorRoland Schulz <roland.schulz@intel.com>
Mon, 28 Jan 2019 04:49:02 +0000 (20:49 -0800)
committerPaul Bauer <paul.bauer.q@gmail.com>
Tue, 19 Feb 2019 07:38:10 +0000 (08:38 +0100)
commitf232a741baa0b2a036f5d25d2b1a2a5d7cb9ccdb
tree8c71fc52838b42fe8e7463142f267d344fcdf318
parentdfa2114913705207ddf932ef753859cf46dfa851
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
CMakeLists.txt
admin/builds/clang-analyzer.py
admin/builds/gromacs.py
cmake/FindLibStdCpp.cmake [new file with mode: 0644]
docs/install-guide/index.rst