From 2d908acc0a5dc520db8c08ce043030d8f48bf9d7 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 6 Apr 2017 13:14:23 -0500 Subject: [PATCH] Make -O2 default for gcc. --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abb900592a..208da7b41c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,8 +108,8 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) endif() # GCC compiler options - list(APPEND f90flags -cpp -std=f2008 -fbacktrace) - list(APPEND cflags -cpp -std=c99) + list(APPEND f90flags -cpp -std=f2008 -fbacktrace -O2) + list(APPEND cflags -cpp -std=c99 -O2) if(debug) list(APPEND f90flags -g -Wall -pedantic -fbounds-check -ffpe-trap=invalid,overflow,underflow) @@ -122,6 +122,8 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) list(APPEND ldflags -pg) endif() if(optimize) + list(REMOVE_ITEM f90flags -O2) + list(REMOVE_ITEM cflags -O2) list(APPEND f90flags -O3) list(APPEND cflags -O3) endif() @@ -190,6 +192,7 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL XL) list(APPEND ldflags -p) endif() if(optimize) + list(REMOVE_ITEM f90flags -O2) list(APPEND f90flags -O3) endif() if(openmp)