@@ -91,28 +91,40 @@ 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
+ endif ()
97
103
98
104
# Add recursive flag
99
- if (_recursiveFlag )
100
- string (REGEX MATCH "-recursive " output_test <string> "${CMAKE_Fortran_FLAGS} " )
105
+ if (_MrecursiveFlag )
106
+ string (REGEX MATCH "-Mrecursive " output_test <string> "${CMAKE_Fortran_FLAGS} " )
101
107
if (NOT output_test )
102
- set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive "
108
+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive "
103
109
CACHE STRING "Recursive flag must be set" FORCE )
104
110
endif ()
105
111
elseif (_frecursiveFlag )
106
112
string (REGEX MATCH "-frecursive" output_test <string> "${CMAKE_Fortran_FLAGS} " )
107
113
if (NOT output_test )
108
114
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -frecursive"
109
- CACHE STRING "Recursive flag must be set" FORCE )
115
+ CACHE STRING "Recursive flag must be set" FORCE )
110
116
endif ()
111
- elseif (_MrecursiveFlag )
112
- string (REGEX MATCH "-Mrecursive " output_test <string> "${CMAKE_Fortran_FLAGS} " )
117
+ elseif (_recursiveFlag )
118
+ string (REGEX MATCH "-recursive " output_test <string> "${CMAKE_Fortran_FLAGS} " )
113
119
if (NOT output_test )
114
- set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive"
115
- CACHE STRING "Recursive flag must be set" FORCE )
120
+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive"
121
+ CACHE STRING "Recursive flag must be set" FORCE )
122
+ endif ()
123
+ elseif (_qrecurFlag )
124
+ string (REGEX MATCH "-qrecur" output_test <string> "${CMAKE_Fortran_FLAGS} " )
125
+ if (NOT output_test )
126
+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qrecur"
127
+ CACHE STRING "Recursive flag must be set" FORCE )
116
128
endif ()
117
129
endif ()
118
130
@@ -121,7 +133,7 @@ if(UNIX)
121
133
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model strict" )
122
134
endif ()
123
135
if (CMAKE_Fortran_COMPILER_ID STREQUAL XL )
124
- set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict=none " )
136
+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qnosave -qstrict" )
125
137
endif ()
126
138
# Delete libmtsk in linking sequence for Sun/Oracle Fortran Compiler.
127
139
# This library is not present in the Sun package SolarisStudio12.3-linux-x86-bin
0 commit comments