From ef66d9a43aea981ce5d63e58d65cf4099e327dab Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 7 Apr 2017 12:08:10 -0500 Subject: [PATCH] Make sure debug mode uses -O0 --- CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 208da7b41..ddb55dcbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,6 +111,8 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) list(APPEND f90flags -cpp -std=f2008 -fbacktrace -O2) list(APPEND cflags -cpp -std=c99 -O2) if(debug) + list(REMOVE_ITEM f90flags -O2) + list(REMOVE_ITEM cflags -O2) list(APPEND f90flags -g -Wall -pedantic -fbounds-check -ffpe-trap=invalid,overflow,underflow) list(APPEND cflags -g -Wall -pedantic -fbounds-check) @@ -144,8 +146,8 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL Intel) list(APPEND cflags -std=c99) if(debug) list(APPEND f90flags -g -warn -ftrapuv -fp-stack-check - "-check all" -fpe0) - list(APPEND cflags -g -w3 -ftrapuv -fp-stack-check) + "-check all" -fpe0 -O0) + list(APPEND cflags -g -w3 -ftrapuv -fp-stack-check -O0) list(APPEND ldflags -g) endif() if(profile) @@ -184,7 +186,8 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL XL) list(APPEND f90flags -O2) add_definitions(-DNO_F2008) if(debug) - list(APPEND f90flags -g -C -qflag=i:i -u) + list(REMOVE_ITEM f90flags -O2) + list(APPEND f90flags -g -C -qflag=i:i -u -O0) list(APPEND ldflags -g) endif() if(profile)