@@ -5,17 +5,32 @@ set(swatexe swat)
5
5
file (GLOB F77SRCS *.f)
6
6
7
7
### Set Fortran line format for source file
8
+ ## Special sources that have fixed length of 79
9
+ set (LEN79_SRCS "bmp_det_pond" "bmpinit" "ovr_sed" "percmain" "readbsn" "rthsed" )
8
10
foreach (F77FILE ${F77SRCS} )
9
11
get_filename_component (CORENAME ${F77FILE} NAME_WE )
12
+ list (FIND LEN79_SRCS ${CORENAME} _FOUND_LEN79)
10
13
if (${CMAKE_Fortran_COMPILER} MATCHES "ifort.*" )
11
14
# ifort, reference https://software.intel.com/en-us/node/678225
12
- if (MSVC ) # ifort integrated in Microsoft Visual Studio
13
- set_source_files_properties (${F77FILE} PROPERTIES COMPILE_FLAGS /4L72)
15
+ if (MSVC ) # ifort integrated in Microsoft Visual Studio
16
+ if (${_FOUND_LEN79} GREATER -1)
17
+ set_source_files_properties (${F77FILE} PROPERTIES COMPILE_FLAGS /4L79)
18
+ else ()
19
+ set_source_files_properties (${F77FILE} PROPERTIES COMPILE_FLAGS /4L72)
20
+ endif ()
14
21
else ()
15
- set_source_files_properties (${F77FILE} PROPERTIES COMPILE_FLAGS -72)
22
+ if (${_FOUND_LEN79} GREATER -1)
23
+ set_source_files_properties (${F77FILE} PROPERTIES COMPILE_FLAGS -79)
24
+ else ()
25
+ set_source_files_properties (${F77FILE} PROPERTIES COMPILE_FLAGS -72)
26
+ endif ()
16
27
endif ()
17
28
else () # gfortran tested only
18
- set_source_files_properties (${F77FILE} PROPERTIES COMPILE_FLAGS -ffixed-line-length -72)
29
+ if (${_FOUND_LEN79} GREATER -1)
30
+ set_source_files_properties (${F77FILE} PROPERTIES COMPILE_FLAGS -ffixed-line-length -79)
31
+ else ()
32
+ set_source_files_properties (${F77FILE} PROPERTIES COMPILE_FLAGS -ffixed-line-length -72)
33
+ endif ()
19
34
endif ()
20
35
endforeach ()
21
36
@@ -42,6 +57,10 @@ if((NOT MSVC) AND (${First_Line_Of_Main_File} MATCHES " include 'modparm.f'
42
57
endif ()
43
58
# Set compile flag according to Fortran line format. These should be consistent with settings above.
44
59
set (Format_Flag "-ffixed-line-length-72" )
60
+ list (FIND LEN79_SRCS ${CORENAME} _FOUND_LEN79)
61
+ if (${_FOUND_LEN79} GREATER -1)
62
+ set (Format_Flag "-ffixed-line-length-79" )
63
+ endif ()
45
64
add_custom_command (OUTPUT ${CORENAME} .o
46
65
COMMAND ${CMAKE_Fortran_COMPILER} ${Compile_Flags_List} ${Format_Flag} -c
47
66
${SRCFILE} DEPENDS main.o)
0 commit comments