It would be useful to have a macro that would check if a compiler flag is available on the compiler at hand before adding it to the list of compiler flags. This would avoid build-time crashes because of flags that are not available and/or have changed name.
This solution is interesting, but my limited tests show that it doesn't always work. The macro should be able to:
set a batch of flags for one compiler (e.g. to set a batch of related flags for the GNU Fortran compiler)
check among different options for the same flag (e.g. compiler version tolerant flag selection)
mark flags as REQUIRED and crash if a flag was not found (e.g. an error flag was not found for the Intel C compiler)
It would be useful to have a macro that would check if a compiler flag is available on the compiler at hand before adding it to the list of compiler flags. This would avoid build-time crashes because of flags that are not available and/or have changed name. This solution is interesting, but my limited tests show that it doesn't always work. The macro should be able to: