From c2079f0c47889b7dab9216a18e085d604e88ce44 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Thu, 7 Sep 2023 21:38:35 -0600 Subject: [PATCH] Honor initial CMAKE_Fortran_FLAGS/FFLAGS --- cmake/CompilerConfiguration.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/CompilerConfiguration.cmake b/cmake/CompilerConfiguration.cmake index 9c46300a5bc..1b3c8959abd 100644 --- a/cmake/CompilerConfiguration.cmake +++ b/cmake/CompilerConfiguration.cmake @@ -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 () @@ -12,15 +12,15 @@ 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) @@ -28,7 +28,7 @@ elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "NAG") 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