diff options
author | julie <julielangou@users.noreply.github.com> | 2010-12-23 00:39:05 +0000 |
---|---|---|
committer | julie <julielangou@users.noreply.github.com> | 2010-12-23 00:39:05 +0000 |
commit | 7c3ad4800fd8eee11741d64a9f7beacf4dbb7b13 (patch) | |
tree | aefa653315e2bdf68710acae28c12c6f974d8d27 /CMAKE | |
parent | c6db164e8dfd64b39e950d1ccf3a561ee9802a02 (diff) | |
download | lapack-7c3ad4800fd8eee11741d64a9f7beacf4dbb7b13.tar.gz lapack-7c3ad4800fd8eee11741d64a9f7beacf4dbb7b13.tar.bz2 lapack-7c3ad4800fd8eee11741d64a9f7beacf4dbb7b13.zip |
Added checks disable floating point exceptions for GNU, Intel, Sun, and IBM compilers and to enforce fixed-form for IBM compilers.
- Chuck Atkins (Kitware)
Diffstat (limited to 'CMAKE')
-rw-r--r-- | CMAKE/CheckLAPACKCompilerFlags.cmake | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/CMAKE/CheckLAPACKCompilerFlags.cmake b/CMAKE/CheckLAPACKCompilerFlags.cmake new file mode 100644 index 00000000..8e1a2fae --- /dev/null +++ b/CMAKE/CheckLAPACKCompilerFlags.cmake @@ -0,0 +1,53 @@ +# This module checks against various known compilers and thier respective +# flags to determine any specific flags needing to be set. +# +# 1. If FPE traps are enabled either abort or disable them +# 2. Specify fixed form if needed + +macro( CheckLAPACKCompilerFlags ) + +set( FPE_EXIT FALSE ) + +# GNU Fortran +if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" ) + if( "${CMAKE_Fortran_FLAGS}" MATCHES "-ffpe-trap=[izoupd]") + set( FPE_EXIT TRUE ) + endif() + +# Intel Fortran +elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" ) + if( ("${CMAKE_Fortran_FLAGS}" MATCHES "[-/]fpe0") OR + ("${CMAKE_Fortran_FLAGS}" MATCHES "[-/]fpe-all=0") ) + set( FPE_EXIT TRUE ) + endif() + +# SunPro F95 +elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" ) + if( ("${CMAKE_Fortran_FLAGS}" MATCHES "-ftrap=") AND + NOT ("${CMAKE_Fortran_FLAGS}" MATCHES "-ftrap=none") ) + set( FPE_EXIT TRUE ) + elseif( NOT (CMAKE_Fortran_FLAGS MATCHES "-ftrap=") ) + message( STATUS "Disabling FPE trap handlers with -ftrap=none" ) + set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ftrap=none" + CACHE STRING "Flags for Fortran compiler." FORCE ) + endif() + +# IBM XL Fortran +elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "VisualAge" ) + if( "${CMAKE_Fortran_FLAGS}" MATCHES "-qflttrap=[a-zA-Z:]:enable" ) + set( FPE_EXIT TRUE ) + endif() + + if( NOT ("${CMAKE_Fortran_FLAGS}" MATCHES "-ffixed-form") ) + set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffixed_form" + CACHE STRING "Flags for Fortran compiler." FORCE ) + endif() + +else() +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() + +endmacro() |