Skip to content

Commit

Permalink
Add proper options for gfortran 4.4 and less
Browse files Browse the repository at this point in the history
Fixes #5.
  • Loading branch information
certik committed Aug 24, 2012
1 parent 997228c commit ba393f7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Expand Up @@ -25,6 +25,14 @@ if (NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR
endif ()

if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION)
if (GCC_VERSION VERSION_LESS 4.5)
set(common "-std=f2008 -Wall -Wextra -Wimplicit-interface -fPIC -Werror -fmax-errors=1")
set(CMAKE_Fortran_FLAGS_RELEASE "${common} -O3 -march=native -ffast-math -funroll-loops")
set(CMAKE_Fortran_FLAGS_DEBUG "${common} -g -fbounds-check -fcheck-array-temporaries -fbacktrace")
endif()

# gfortran
# Enable this if you want to check for single/double corruption (and use
# the Debug build):
Expand Down

1 comment on commit ba393f7

@barracuda156
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@certik -march=native should be used conditionally, it is not supported on PPC (any OS).

Please sign in to comment.