[cmake-developers] New module: CheckFortranCompilerFlag.cmake

Nicolas Bock nicolasbock at gmail.com
Tue Feb 3 15:21:45 EST 2015


On Tue, Feb 3, 2015 at 1:18 PM, Brad King <brad.king at kitware.com> wrote:
> On 02/03/2015 07:46 AM, Nicolas Bock wrote:
>> please find attached a patch based on 460f7bcb7d11e905ee025c9d9cc9629d597fa91b.
>
> Thanks.  Was this based on CheckCCompilerFlag from that version too?
>
Yes.

> On 02/01/2015 04:18 AM, Rolf Eike Beer wrote:
>> Also I don't know if it makes sense to check for certain flags that look
>> specific to C++. Which compilers did you use to test?
>
> Agreed.  Do you have example failure messages from any compilers?
>
I will collect some.

> Local testing of GNU Fortran 4.9 shows that bad flags are rejected with
> an error.  Do we need the pattern matches for any Fortran compilers?
I have tested with gcc and Intel (ifort). Ifort gives out warnings for
illegal flags, stating that it will ignore them. In my (very basic)
testing the warning lead to test failure of the module, i.e.. it lead
to the correct behavior. I have access to PGI and possibly NAG's
compilers as well and will test whether error messages are caught.

>
>> +     # Some compilers do not fail with a bad flag
>> +     FAIL_REGEX "command line option .* is valid for .* but not for C" # GNU
>> +     ${_CheckFortranCompilerFlag_COMMON_PATTERNS}
>
> Certainly the "but not for C" message will not show up from a
> Fortran compiler.
>
Oops, yes good point.

> Thanks,
> -Brad
>


More information about the cmake-developers mailing list