Simplify C++ compiler flag setup and use
The end point of this MR will be to export compiler flags required by clients of libvecgeom
to CMake/pkg-config files so that these are applied automatically. The canonical case is the arch flag as this determines the (maximum) ISA compiled into the library. As submitted, the changes are:
- Rationalize setting of Clang/Intel/GNU flags so these appear in the same order and are as common as can be
- Add error limit reporting for Intel/Clang
- Intel can support
-ggdb
- The explicit setting of
-fPIC
is removed, replaced byCMAKE_POSITION_INDEPENDENT_CODE
- Provide C++17 support for Intel compilers using usage requirements
- De-duplicate flags that appear in both
VECGEOM_CXX_FLAGS
andVECGEOM_COMPILATION_FLAGS
, only setting them in the latter
This last step is the foundation for the export of flags - it contains the flags that must be used by clients of libvecgeom
when they compile/link against it. That export isn't done yet as I would like to get a cycle of testing in just to confirm the flag changes don't break things.
I'd also like a readout/confirmation that the current VECGEOM_CXX_FLAGS
and VECGEOM_COMPILATION_FLAGS
(ignoring the ISA flags) are o.k., whether they are still required, and why we need them. For example -diag-disable 3438
on Intel. I'll fixup any issues here and add comments on why we're using the flag in question.