From f19fb4ee336a8e82c97fd4b24a9e8acb4c70373f Mon Sep 17 00:00:00 2001 From: julie Date: Sat, 26 Feb 2011 20:49:40 +0000 Subject: Recude RELEASE optimization level from O>3 to O2 - Chuck Atkins (Kitware) --- CMAKE/CheckLAPACKCompilerFlags.cmake | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'CMAKE') diff --git a/CMAKE/CheckLAPACKCompilerFlags.cmake b/CMAKE/CheckLAPACKCompilerFlags.cmake index b7b584bc..4f2884c4 100644 --- a/CMAKE/CheckLAPACKCompilerFlags.cmake +++ b/CMAKE/CheckLAPACKCompilerFlags.cmake @@ -3,10 +3,11 @@ # # 1. If FPE traps are enabled either abort or disable them # 2. Specify fixed form if needed -# +# 3. Ensure that Release builds use O2 instead of O3 +# #============================================================================= # Author: Chuck Atkins -# Copyright 2010 +# Copyright 2011 #============================================================================= macro( CheckLAPACKCompilerFlags ) @@ -52,6 +53,15 @@ elseif( (CMAKE_Fortran_COMPILER_ID STREQUAL "VisualAge" ) OR # CMake 2.6 else() endif() +if( "${CMAKE_Fortran_FLAGS_RELEASE}" MATCHES "O[3-9]" ) + message( STATUS "Reducing RELEASE optimization level from to O2" ) + string( REGEX REPLACE "O[3-9]" "O2" CMAKE_Fortran_FLAGS_RELEASE + "${CMAKE_Fortran_FLAGS_RELEASE}" ) + set( CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" + CACHE STRING "Flags used by the compiler during release builds" FORCE ) +endif() + + if( FPE_EXIT ) message( FATAL_ERROR "Floating Point Exception (FPE) trap handlers are currently explicitly enabled in the compiler flags. LAPACK is designed to check for and handle these cases internally and enabling these traps will likely cause LAPACK to crash. Please re-configure with floating point exception trapping disabled." ) endif() -- cgit v1.2.3