summaryrefslogtreecommitdiff
path: root/CMAKE
diff options
context:
space:
mode:
authorjulie <julielangou@users.noreply.github.com>2011-02-26 20:49:40 +0000
committerjulie <julielangou@users.noreply.github.com>2011-02-26 20:49:40 +0000
commitf19fb4ee336a8e82c97fd4b24a9e8acb4c70373f (patch)
treee8de2fb58c926e2e1b81397159ebc57ca2810e2f /CMAKE
parent27bef224d9e4e8fdadc0e33d70c98d9a10a0d149 (diff)
downloadlapack-f19fb4ee336a8e82c97fd4b24a9e8acb4c70373f.tar.gz
lapack-f19fb4ee336a8e82c97fd4b24a9e8acb4c70373f.tar.bz2
lapack-f19fb4ee336a8e82c97fd4b24a9e8acb4c70373f.zip
Recude RELEASE optimization level from O>3 to O2
- Chuck Atkins (Kitware)
Diffstat (limited to 'CMAKE')
-rw-r--r--CMAKE/CheckLAPACKCompilerFlags.cmake14
1 files changed, 12 insertions, 2 deletions
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()