@@ -91,28 +91,40 @@ 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+ endif ()
97103
98104# 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} " )
101107 if (NOT output_test)
102- set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive "
108+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive "
103109 CACHE STRING "Recursive flag must be set" FORCE )
104110 endif ()
105111elseif (_frecursiveFlag)
106112 string (REGEX MATCH "-frecursive" output_test <string> "${CMAKE_Fortran_FLAGS} " )
107113 if (NOT output_test)
108114 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 )
110116 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} " )
113119 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 )
116128 endif ()
117129endif ()
118130
@@ -121,7 +133,7 @@ if(UNIX)
121133 set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model strict" )
122134 endif ()
123135 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" )
125137 endif ()
126138# Delete libmtsk in linking sequence for Sun/Oracle Fortran Compiler.
127139# This library is not present in the Sun package SolarisStudio12.3-linux-x86-bin
0 commit comments