summaryrefslogtreecommitdiffstats
path: root/Modules/CheckFortranCompilerFlag.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/CheckFortranCompilerFlag.cmake')
-rw-r--r--Modules/CheckFortranCompilerFlag.cmake28
1 files changed, 3 insertions, 25 deletions
diff --git a/Modules/CheckFortranCompilerFlag.cmake b/Modules/CheckFortranCompilerFlag.cmake
index b8fac97..0f5cf9a 100644
--- a/Modules/CheckFortranCompilerFlag.cmake
+++ b/Modules/CheckFortranCompilerFlag.cmake
@@ -36,30 +36,8 @@ effect or even a specific one is beyond the scope of this module.
include_guard(GLOBAL)
include(CheckFortranSourceCompiles)
-include(CMakeCheckCompilerFlagCommonPatterns)
+include(CheckCompilerFlag)
-macro (CHECK_Fortran_COMPILER_FLAG _FLAG _RESULT)
- set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
- set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
-
- # Normalize locale during test compilation.
- set(_CheckFortranCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG)
- foreach(v ${_CheckFortranCompilerFlag_LOCALE_VARS})
- set(_CheckFortranCompilerFlag_SAVED_${v} "$ENV{${v}}")
- set(ENV{${v}} C)
- endforeach()
- CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckFortranCompilerFlag_COMMON_PATTERNS)
- CHECK_Fortran_SOURCE_COMPILES(" program test\n stop\n end program" ${_RESULT}
- # Some compilers do not fail with a bad flag
- FAIL_REGEX "command line option .* is valid for .* but not for Fortran" # GNU
- ${_CheckFortranCompilerFlag_COMMON_PATTERNS}
- )
- foreach(v ${_CheckFortranCompilerFlag_LOCALE_VARS})
- set(ENV{${v}} ${_CheckFortranCompilerFlag_SAVED_${v}})
- unset(_CheckFortranCompilerFlag_SAVED_${v})
- endforeach()
- unset(_CheckFortranCompilerFlag_LOCALE_VARS)
- unset(_CheckFortranCompilerFlag_COMMON_PATTERNS)
-
- set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
+macro (CHECK_FORTRAN_COMPILER_FLAG _FLAG _RESULT)
+ check_compiler_flag(Fortran "${_FLAG}" ${_RESULT})
endmacro ()