@@ -91,28 +91,44 @@ include(PreventInBuildInstalls)
91
91
92
92
# Check if recursive flag exists
93
93
include (CheckFortranCompilerFlag )
94
- check_fortran_compiler_flag ("-recursive" _recursiveFlag )
95
- check_fortran_compiler_flag ("-frecursive" _frecursiveFlag )
96
- check_fortran_compiler_flag ("-Mrecursive" _MrecursiveFlag )
94
+ if (CMAKE_Fortran_COMPILER_ID STREQUAL Flang )
95
+ check_fortran_compiler_flag ("-Mrecursive" _MrecursiveFlag )
96
+ elseif (CMAKE_Fortran_COMPILER_ID STREQUAL GNU )
97
+ check_fortran_compiler_flag ("-frecursive" _frecursiveFlag )
98
+ elseif (CMAKE_Fortran_COMPILER_ID STREQUAL Intel )
99
+ check_fortran_compiler_flag ("-recursive" _recursiveFlag )
100
+ elseif (CMAKE_Fortran_COMPILER_ID STREQUAL XL )
101
+ check_fortran_compiler_flag ("-qrecur" _qrecurFlag )
102
+ else ()
103
+ message (WARNING "Fortran local arrays should be allocated on the stack."
104
+ " Please use a compiler which guarantees that feature."
105
+ " See https://github.com/Reference-LAPACK/lapack/pull/188 and references therein." )
106
+ endif ()
97
107
98
108
# Add recursive flag
99
- if (_recursiveFlag )
100
- string (REGEX MATCH "-recursive " output_test <string> "${CMAKE_Fortran_FLAGS} " )
109
+ if (_MrecursiveFlag )
110
+ string (REGEX MATCH "-Mrecursive " output_test <string> "${CMAKE_Fortran_FLAGS} " )
101
111
if (NOT output_test )
102
- set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive "
112
+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive "
103
113
CACHE STRING "Recursive flag must be set" FORCE )
104
114
endif ()
105
115
elseif (_frecursiveFlag )
106
116
string (REGEX MATCH "-frecursive" output_test <string> "${CMAKE_Fortran_FLAGS} " )
107
117
if (NOT output_test )
108
118
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -frecursive"
109
- CACHE STRING "Recursive flag must be set" FORCE )
119
+ CACHE STRING "Recursive flag must be set" FORCE )
110
120
endif ()
111
- elseif (_MrecursiveFlag )
112
- string (REGEX MATCH "-Mrecursive " output_test <string> "${CMAKE_Fortran_FLAGS} " )
121
+ elseif (_recursiveFlag )
122
+ string (REGEX MATCH "-recursive " output_test <string> "${CMAKE_Fortran_FLAGS} " )
113
123
if (NOT output_test )
114
- set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive"
115
- CACHE STRING "Recursive flag must be set" FORCE )
124
+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive"
125
+ CACHE STRING "Recursive flag must be set" FORCE )
126
+ endif ()
127
+ elseif (_qrecurFlag )
128
+ string (REGEX MATCH "-qrecur" output_test <string> "${CMAKE_Fortran_FLAGS} " )
129
+ if (NOT output_test )
130
+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qrecur"
131
+ CACHE STRING "Recursive flag must be set" FORCE )
116
132
endif ()
117
133
endif ()
118
134
@@ -121,7 +137,7 @@ if(UNIX)
121
137
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model strict" )
122
138
endif ()
123
139
if (CMAKE_Fortran_COMPILER_ID STREQUAL XL )
124
- set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict=none " )
140
+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict" )
125
141
endif ()
126
142
# Delete libmtsk in linking sequence for Sun/Oracle Fortran Compiler.
127
143
# This library is not present in the Sun package SolarisStudio12.3-linux-x86-bin
0 commit comments