1 |
if(CMAKE_Fortran_COMPILER_ID MATCHES GNU) |
2 |
# Fortran language options: |
3 |
string(APPEND CMAKE_Fortran_FLAGS " -std=f2003") |
4 |
|
5 |
# Error and warning options: |
6 |
string(APPEND CMAKE_Fortran_FLAGS |
7 |
" -fmax-errors=1 -pedantic -Wall -Wcharacter-truncation -Wunused-parameter -Wno-conversion -Wno-integer-division") |
8 |
|
9 |
# Debugging options: |
10 |
set(CMAKE_Fortran_FLAGS_DEBUG |
11 |
"-fbacktrace -g -ffpe-trap=invalid,zero,overflow") |
12 |
|
13 |
# Code generation options: |
14 |
string(APPEND CMAKE_Fortran_FLAGS_DEBUG |
15 |
" -fcheck=bounds,do,mem,pointer,recursion -finit-real=nan -O0") |
16 |
|
17 |
# Optimization options: |
18 |
set(CMAKE_Fortran_FLAGS_RELEASE -O3) |
19 |
|
20 |
# Hardware model options: |
21 |
string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -mcmodel=medium") |
22 |
elseif(CMAKE_Fortran_COMPILER_ID MATCHES Intel) |
23 |
# Language: |
24 |
string(APPEND CMAKE_Fortran_FLAGS |
25 |
" -noaltparam -stand f03 -standard-semantics -assume nostd_mod_proc_name") |
26 |
string(APPEND CMAKE_Fortran_FLAGS_DEBUG |
27 |
" -check bounds,format,output_conversion,pointers,stack,uninit") |
28 |
|
29 |
# Data: |
30 |
string(APPEND CMAKE_Fortran_FLAGS " -auto -mcmodel=medium") |
31 |
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -init=arrays,minus_huge,snan") |
32 |
|
33 |
# Compiler diagnostics: |
34 |
string(APPEND CMAKE_Fortran_FLAGS |
35 |
" -warn declarations,general,stderrors,truncated_source,uncalled,unused,usage -traceback -diag-error-limit 1") |
36 |
|
37 |
# Optimization: |
38 |
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -O0") |
39 |
|
40 |
# Floating point: |
41 |
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -fp-stack-check -fpe-all=0") |
42 |
|
43 |
# Debug: |
44 |
string(APPEND CMAKE_Fortran_FLAGS_DEBUG |
45 |
" -debug full -debug-parameters all -ftrapuv") |
46 |
endif() |