@@ -92,6 +92,40 @@ configure_file(
9292include (PreventInSourceBuilds )
9393include (PreventInBuildInstalls )
9494
95+ # # Following nomenclature from here:
96+ # # https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html
97+ # if (CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
98+ # set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -frecursive")
99+ # # elseif(CMAKE_Fortran_COMPILER_ID MATCHES "G95")
100+ # # set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -frecursive")
101+ # elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
102+ # set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive")
103+ # elseif(CMAKE_Fortran_COMPILER_ID MATCHES "IntelLLVM")
104+ # set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive")
105+ # elseif(CMAKE_Fortran_COMPILER_ID MATCHES "NVIDIA")
106+ # set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive")
107+ # elseif(CMAKE_Fortran_COMPILER_ID MATCHES "PGI")
108+ # set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive")
109+ # endif()
110+
111+ # Check if recursive flag exists
112+ include (CheckFortranCompilerFlag )
113+ check_fortran_compiler_flag ("-recursive" _recursiveFlag )
114+ check_fortran_compiler_flag ("-frecursive" _frecursiveFlag )
115+ check_fortran_compiler_flag ("-Mrecursive" _MrecursiveFlag )
116+
117+ # Add recursive flag
118+ if (_recursiveFlag)
119+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive" )
120+ # message(STATUS ${CMAKE_Fortran_FLAGS})
121+ elseif (_frecursiveFlag)
122+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -frecursive" )
123+ # message(STATUS ${CMAKE_Fortran_FLAGS})
124+ elseif (_MrecursiveFlag)
125+ set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive" )
126+ # message(STATUS ${CMAKE_Fortran_FLAGS})
127+ endif ()
128+
95129if (UNIX )
96130 if (CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
97131 set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fp-model strict" )
0 commit comments