Make -O2 default for gcc.

This commit is contained in:
Paul Romano 2017-04-06 13:14:23 -05:00
parent 47deaa8c60
commit 2d908acc0a

View file

@ -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)