bilke / cmake-modules

Additional CMake functionality. Most of the modules are from Ryan Pavlik (https://github.com/rpavlik/cmake-modules)
Boost Software License 1.0
548 stars 213 forks source link

Added gfortran support #42

Closed apthorpe closed 4 years ago

apthorpe commented 4 years ago

I've added minimal support for gfortran. The original code was failing on undefined/incompatible C/C++ compiler so I added a workaround check for gfortran at the point the original was failing. This might break if you have a mixed-language project and you're using an incompatible C/C++ compiler but (for some reason) you're using gfortran. That seems unlikely but regardless, the logic should checked over and you may want to replace it with something more robust.

Beyond that, I followed the pattern established for setting options for C and C++ compilers.

I've tested this locally with CMake 3.14.4, gfortran & gcov 9.2.1, and HEAD of lcov (GCC 9.x format output from gcov is only supported in the bleeding-edge release of lcov)

This is more of a minimal proof-of-concept than thoroughly tested production code; I don't believe there are any major faults but it definitely needs review and additional testing.

FWIW, seeing coverage stats for legacy Fortran code running sample cases is incredibly helpful. It's amazing how spoiled you feel using a language with test facilities...

bilke commented 4 years ago

@apthorpe Thanks!