@@ -105,10 +105,6 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Cray")
105105 set (compile_flags_debug -O0 -Rbcps -Ktrap=fp)
106106endif ()
107107
108- target_compile_options (ww3_lib PUBLIC "$<$<COMPILE_LANGUAGE:Fortran>:${compile_flags} >" )
109- target_compile_options (ww3_lib PUBLIC "$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:Fortran>>:${compile_flags_debug} >" )
110- target_compile_options (ww3_lib PUBLIC "$<$<AND:$<CONFIG:Release>,$<COMPILE_LANGUAGE:Fortran>>:${compile_flags_release} >" )
111-
112108# Executables to always build
113109set (programs ww3_strt ww3_grid ww3_bound ww3_outf ww3_outp ww3_trck ww3_grib
114110 ww3_gint gx_outf gx_outp ww3_uprstr ww3_shel ww3_prep ww3_gspl ww3_multi ww3_systrk)
@@ -181,16 +177,23 @@ endif()
181177# Handle PDLIB, SCRIP, SCRIPNC build files directly instead of through configuration file
182178if ("PDLIB" IN_LIST switches)
183179 if ("SCOTCH" IN_LIST switches)
184- find_package (SCOTCH REQUIRED)
185- target_sources (ww3_lib PRIVATE ${pdlib_src} )
186- target_link_libraries (ww3_lib PUBLIC PTSCOTCHparmetis::PTSCOTCHparmetis)
187- elseif ("METIS" IN_LIST switches)
188- find_package (ParMETIS REQUIRED)
189- target_sources (ww3_lib PRIVATE ${pdlib_src} )
190- target_link_libraries (ww3_lib PUBLIC ParMETIS::ParMETIS)
180+ find_package (SCOTCH REQUIRED)
181+ target_sources (ww3_lib PRIVATE ${pdlib_src} )
182+ target_link_libraries (ww3_lib PUBLIC PTSCOTCHparmetis::PTSCOTCHparmetis)
183+ if (SCOTCH_VERSION VERSION_GREATER "7.0.6" )
184+ list (APPEND compile_flags -DSCOTCH_707)
185+ list (APPEND compile_flags_release -DSCOTCH_707)
186+ list (APPEND compile_flags_debug -DSCOTCH_707)
187+ else ()
188+ message (STATUS "SOCTCH version 7.06 or lower" )
189+ endif ()
190+ elseif ("METIS" IN_LIST switches)
191+ find_package (ParMETIS REQUIRED)
192+ target_sources (ww3_lib PRIVATE ${pdlib_src} )
193+ target_link_libraries (ww3_lib PUBLIC ParMETIS::ParMETIS)
191194 else ()
192195 message (FATAL_ERROR "PDLIB requires METIS or SCOTCH library for domain decomposition" )
193- endif ()
196+ endif ()
194197endif ()
195198
196199if ("SCRIP" IN_LIST switches)
@@ -224,6 +227,10 @@ foreach(program ${programs})
224227 target_link_libraries (${program} PRIVATE ww3_lib)
225228endforeach ()
226229
230+ target_compile_options (ww3_lib PUBLIC "$<$<COMPILE_LANGUAGE:Fortran>:${compile_flags} >" )
231+ target_compile_options (ww3_lib PUBLIC "$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:Fortran>>:${compile_flags_debug} >" )
232+ target_compile_options (ww3_lib PUBLIC "$<$<AND:$<CONFIG:Release>,$<COMPILE_LANGUAGE:Fortran>>:${compile_flags_release} >" )
233+
227234install (
228235 TARGETS ${programs} ww3_lib
229236 EXPORT WW3Exports
0 commit comments