Skip to content

Commit ebaba80

Browse files
Improve control of recursive flags in the Makefiles
1 parent d835f86 commit ebaba80

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

CMakeLists.txt

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,23 @@ check_fortran_compiler_flag("-Mrecursive" _MrecursiveFlag)
100100

101101
# Add recursive flag
102102
if(_recursiveFlag)
103-
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive")
104-
# message(STATUS ${CMAKE_Fortran_FLAGS})
103+
string(REGEX MATCH "-recursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
104+
if(NOT output_test)
105+
message(STATUS "Adding recursive flag to CMAKE_Fortran_FLAGS.")
106+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -recursive")
107+
endif()
105108
elseif(_frecursiveFlag)
106-
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -frecursive")
107-
# message(STATUS ${CMAKE_Fortran_FLAGS})
109+
string(REGEX MATCH "-frecursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
110+
if(NOT output_test)
111+
message(STATUS "Adding recursive flag to CMAKE_Fortran_FLAGS.")
112+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -frecursive")
113+
endif()
108114
elseif(_MrecursiveFlag)
109-
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive")
110-
# message(STATUS ${CMAKE_Fortran_FLAGS})
115+
string(REGEX MATCH "-Mrecursive" output_test <string> "${CMAKE_Fortran_FLAGS}")
116+
if(NOT output_test)
117+
message(STATUS "Adding recursive flag to CMAKE_Fortran_FLAGS.")
118+
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Mrecursive")
119+
endif()
111120
endif()
112121

113122
if(UNIX)

TESTING/EIG/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ cleanobj:
157157
cleanexe:
158158
rm -f xeigtst*
159159

160-
FFLAGS_DRV_NORECURSIVE := $(filter-out -frecursive -Mrecursive,$(FFLAGS_DRV))
160+
FFLAGS_DRV_NORECURSIVE := $(filter-out -frecursive -Mrecursive -recursive,$(FFLAGS_DRV))
161161

162162
schkee.o: schkee.f
163163
$(FC) $(FFLAGS_DRV) -c -o $@ $<

0 commit comments

Comments
 (0)