Skip to content

Commit 3289512

Browse files
dougiesquireharshula
authored andcommitted
CMakeLists.txt: add -fp-model flags as in MOM and FMS
1 parent 622ff41 commit 3289512

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ project(GFDLGTracers
1111

1212
include(GNUInstallDirs)
1313
include(CMakePackageConfigHelpers)
14+
include(CheckFortranCompilerFlag)
1415

1516
if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$")
1617
message(STATUS "Setting build type to 'Relwithdebinfo' as none was specified.")
@@ -37,22 +38,30 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
3738

3839
# Copied from MOM5/bin/mkmf.template.nci.gfortran
3940
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fcray-pointer -fdefault-real-8 -ffree-line-length-none -fno-range-check -Waliasing -Wampersand -Warray-bounds -Wcharacter-truncation -Wconversion -Wline-truncation -Wintrinsics-std -Wsurprising -Wno-tabs -Wunderflow -Wunused-parameter -Wintrinsic-shadow -Wno-align-commons")
41+
check_fortran_compiler_flag("-fallow-invalid-boz" _boz_flag)
42+
check_fortran_compiler_flag("-fallow-argument-mismatch" _argmis_flag)
43+
if(_boz_flag)
44+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-invalid-boz" )
45+
endif()
46+
if(_argmis_flag)
47+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch" )
48+
endif()
4049
set(CMAKE_Fortran_FLAGS_RELEASE "-O2")
4150
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g")
4251
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -W -fbounds-check")
4352

4453
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
4554

4655
# Copied from MOM5/bin/mkmf.template.nci
47-
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-alias -safe-cray-ptr -fpe0 -ftz -assume byterecl -i4 -r8 -traceback -nowarn -check noarg_temp_created -assume nobuffered_io -convert big_endian -grecord-gcc-switches -align all")
56+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-alias -safe-cray-ptr -fpe0 -ftz -assume byterecl -i4 -r8 -traceback -nowarn -check noarg_temp_created -assume nobuffered_io -convert big_endian -grecord-gcc-switches -fp-model precise -fp-model source -align all")
4857
set(CMAKE_Fortran_FLAGS_RELEASE "-g3 -O2 -xCORE-AVX2 -debug all -check none")
4958
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g3 -O2 -xCORE-AVX2 -debug all -check none")
5059
set(CMAKE_Fortran_FLAGS_DEBUG "-g3 -O0 -debug all -check -check noarg_temp_created -check nopointer -warn -warn noerrors -ftrapuv")
5160

5261
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM")
5362

5463
# Copied from MOM5/bin/mkmf.template.nci
55-
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-alias -safe-cray-ptr -fpe0 -ftz -assume byterecl -i4 -r8 -traceback -nowarn -check noarg_temp_created -assume nobuffered_io -convert big_endian -grecord-gcc-switches -align all")
64+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-alias -safe-cray-ptr -fpe0 -ftz -assume byterecl -i4 -r8 -traceback -nowarn -check noarg_temp_created -assume nobuffered_io -convert big_endian -grecord-gcc-switches -fp-model precise -fp-model source -align all")
5665
set(CMAKE_Fortran_FLAGS_RELEASE "-g3 -O2 -xCORE-AVX2 -debug all -check none")
5766
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-g3 -O2 -xCORE-AVX2 -debug all -check none")
5867
set(CMAKE_Fortran_FLAGS_DEBUG "-g3 -O0 -debug all -check -check noarg_temp_created -check nopointer -warn -warn noerrors -ftrapuv")

0 commit comments

Comments
 (0)