diff options
author | Brad King <brad.king@kitware.com> | 2023-11-22 12:23:54 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-11-22 12:24:01 (GMT) |
commit | d0dc8eea2f1ed81f6fe36050137f214f72257a61 (patch) | |
tree | 11e1ddcfb5890b441e16c82064683709e5f471a5 /Modules | |
parent | 09b63dbc4251718d96c9bfbc03f473e74a222dec (diff) | |
parent | 4597fee41f08afe3489761f8b2f08b8ca0243408 (diff) | |
download | CMake-d0dc8eea2f1ed81f6fe36050137f214f72257a61.zip CMake-d0dc8eea2f1ed81f6fe36050137f214f72257a61.tar.gz CMake-d0dc8eea2f1ed81f6fe36050137f214f72257a61.tar.bz2 |
Merge topic 'gfortran-flags'
4597fee41f GNU: Remove duplicate and unnecessary optimization flags for gfortran
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8994
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/Compiler/GNU-Fortran.cmake | 4 | ||||
-rw-r--r-- | Modules/Compiler/GNU.cmake | 11 |
2 files changed, 8 insertions, 7 deletions
diff --git a/Modules/Compiler/GNU-Fortran.cmake b/Modules/Compiler/GNU-Fortran.cmake index 5dfb03e..452598b 100644 --- a/Modules/Compiler/GNU-Fortran.cmake +++ b/Modules/Compiler/GNU-Fortran.cmake @@ -17,10 +17,6 @@ endif() set(CMAKE_Fortran_POSTPROCESS_FLAG "-fpreprocessed") -# No -DNDEBUG for Fortran. -string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " -Os") -string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O3") - # No -isystem for Fortran because it will not find .mod files. unset(CMAKE_INCLUDE_SYSTEM_FLAG_Fortran) diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index bb367ea..88c8997 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -109,9 +109,14 @@ macro(__compiler_gnu lang) # Initial configuration flags. string(APPEND CMAKE_${lang}_FLAGS_INIT " ") string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g") - string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG") - string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG") - string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG") + string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -Os") + string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3") + string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g") + if(NOT "x${lang}" STREQUAL "xFortran") + string(APPEND CMAKE_${lang}_FLAGS_MINSIZEREL_INIT " -DNDEBUG") + string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -DNDEBUG") + string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -DNDEBUG") + endif() set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") if(NOT APPLE OR NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4) # work around #4462 |