Index: Modules/Compiler/GNU-Fortran.cmake --- Modules/Compiler/GNU-Fortran.cmake.orig +++ Modules/Compiler/GNU-Fortran.cmake @@ -17,9 +17,11 @@ 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") +if(NOT DEFINED ENV{MODCMAKE_PORT_BUILD}) + # No -DNDEBUG for Fortran. + string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " -Os") + string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O3") +endif() # No -isystem for Fortran because it will not find .mod files. unset(CMAKE_INCLUDE_SYSTEM_FLAG_Fortran)