Manage compiler flags and some include options per file or target, not globally
authorMark Abraham <mark.j.abraham@gmail.com>
Wed, 31 Jul 2019 09:55:35 +0000 (11:55 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Thu, 1 Aug 2019 13:16:43 +0000 (15:16 +0200)
commit3db9c194b7d1851d2289d3cfbf625de0fc3e8efe
treefaec018324ccfc444d7d0c37ff229bbdebe99e03
parenta676045370c75d75d2a4c5f07a28a7ec25954c59
Manage compiler flags and some include options per file or target, not globally

The legacy CMake approach of adding to the global compiler flags
variables is no longer accepted practice. Following the new idiom will
give us more control, e.g. over whether warning flags intended for
GROMACS code will apply to e.g. external code. Now all kinds of
generated and external code cannot emit any of the warnings that we
intend to enable for GROMACS code.

Compiler command lines are now constructed from proper CMake lists of
flags, ie. with semicolon separators. This means we can use more
modern CMake idiom with generator strings, rather than munging our own
strings into compiler command lines.

Similarly, include directories such as for thread-MPI are no longer
added globally.

Some flags that disable warnings activated by bulk warning flags are
changed to be detected in an order that still produces a list of flags
that disables groups of warnings as intended.

Silenced a few MSVC warnings about things that are not worth fixing
for GROMACS.

Change-Id: I8cc470ad74264dc11bc292988f50cc16cbb02437
30 files changed:
CMakeLists.txt
cmake/gmxCFlags.cmake
cmake/gmxManageFFTLibraries.cmake
cmake/gmxManageSimd.cmake
cmake/gmxManageTNG.cmake
share/template/CMakeLists.txt
share/template/template.cpp
src/CMakeLists.txt
src/api/cpp/CMakeLists.txt
src/external/googletest/CMakeLists.txt
src/gromacs/CMakeLists.txt
src/gromacs/analysisdata/dataframe.h
src/gromacs/domdec/partition.cpp
src/gromacs/ewald/pme_spread.cpp
src/gromacs/fileio/CMakeLists.txt
src/gromacs/linearalgebra/CMakeLists.txt
src/gromacs/listed_forces/position_restraints.cpp
src/gromacs/math/functions.h
src/gromacs/math/vec.h
src/gromacs/selection/CMakeLists.txt
src/gromacs/selection/nbsearch.h
src/gromacs/topology/block.h
src/gromacs/topology/forcefieldparameters.h
src/gromacs/topology/idef.h
src/gromacs/topology/topology.h
src/gromacs/utility/smalloc.h
src/programs/CMakeLists.txt
src/programs/mdrun/tests/CMakeLists.txt
src/testutils/CMakeLists.txt
src/testutils/TestMacros.cmake