Skip to content

Commit

Permalink
Honor initial CMAKE_Fortran_FLAGS/FFLAGS
Browse files Browse the repository at this point in the history
  • Loading branch information
opoplawski authored and hfp committed Sep 11, 2023
1 parent 3796cea commit c2079f0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmake/CompilerConfiguration.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
set(CMAKE_Fortran_FLAGS "-ffree-form -std=f2008ts -fimplicit-none -Werror=aliasing -Werror=ampersand -Werror=c-binding-type -Werror=intrinsic-shadow -Werror=intrinsics-std -Werror=line-truncation -Werror=tabs -Werror=target-lifetime -Werror=underflow -Werror=unused-but-set-parameter -Werror=unused-but-set-variable -Werror=unused-variable -Werror=unused-dummy-argument -Werror=conversion -Werror=zerotrip -Werror=uninitialized -Wno-maybe-uninitialized -Werror=unused-parameter")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-form -std=f2008ts -fimplicit-none -Werror=aliasing -Werror=ampersand -Werror=c-binding-type -Werror=intrinsic-shadow -Werror=intrinsics-std -Werror=line-truncation -Werror=tabs -Werror=target-lifetime -Werror=underflow -Werror=unused-but-set-parameter -Werror=unused-but-set-variable -Werror=unused-variable -Werror=unused-dummy-argument -Werror=conversion -Werror=zerotrip -Werror=uninitialized -Wno-maybe-uninitialized -Werror=unused-parameter")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Werror=argument-mismatch") # gcc 10+ has this automatically
else ()
Expand All @@ -12,23 +12,23 @@ if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -fsanitize=leak")
endif ()
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
set(CMAKE_Fortran_FLAGS "-free -stand=f18 -fpp -heap-arrays")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -free -stand=f18 -fpp -heap-arrays")
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -g")
set(CMAKE_Fortran_FLAGS_DEBUG "-O2 -debug")
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")
set(CMAKE_Fortran_FLAGS "-Mfreeform -Mextend -Mallocatable=03") # -Mallocatable=03: enable F2003+ assignment semantics
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mfreeform -Mextend -Mallocatable=03") # -Mallocatable=03: enable F2003+ assignment semantics
set(CMAKE_Fortran_FLAGS_RELEASE "-fast")
set(CMAKE_Fortran_FLAGS_DEBUG "-g")
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "NAG")
set(CMAKE_Fortran_FLAGS "-f2008 -free -Warn=reallocation -Warn=subnormal")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -f2008 -free -Warn=reallocation -Warn=subnormal")
set(CMAKE_Fortran_FLAGS_RELEASE "-O2")
set(CMAKE_Fortran_FLAGS_DEBUG "-g -C")
if (NOT OpenMP_FOUND)
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -gline") # -gline is only supported without OpenMP
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -C=all") # some checks are not available with OpenMP
endif ()
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
set(CMAKE_Fortran_FLAGS "-f free -M3105 -ME7212") # -M3105: hide a false-positive warning about modified loop variables due to loop fusing, promote warning 7212 to an error
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -f free -M3105 -ME7212") # -M3105: hide a false-positive warning about modified loop variables due to loop fusing, promote warning 7212 to an error
set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -G2")
set(CMAKE_Fortran_FLAGS_DEBUG "-G2")
set(CMAKE_Fortran_MODOUT_FLAG "-ef") # override to get lower-case module file names
Expand Down

0 comments on commit c2079f0

Please sign in to comment.