@@ -91,28 +91,44 @@ include(PreventInBuildInstalls)
9191
9292# Check if recursive flag exists
9393include (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 ()
97107
98108# 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} " )
101111 if (NOT output_test)
102- set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive "
112+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive "
103113 CACHE STRING "Recursive flag must be set" FORCE )
104114 endif ()
105115elseif (_frecursiveFlag)
106116 string (REGEX MATCH "-frecursive" output_test <string> "${CMAKE_Fortran_FLAGS} " )
107117 if (NOT output_test)
108118 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 )
110120 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} " )
113123 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 )
116132 endif ()
117133endif ()
118134
@@ -121,7 +137,7 @@ if(UNIX)
121137 set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model strict" )
122138 endif ()
123139 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" )
125141 endif ()
126142# Delete libmtsk in linking sequence for Sun/Oracle Fortran Compiler.
127143# This library is not present in the Sun package SolarisStudio12.3-linux-x86-bin
0 commit comments