From fbd8e271b19b06b086421ef2926151ceceb4c7eb Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Fri, 14 Oct 2022 23:10:25 +0200
Subject: [PATCH] Update `CMakeLists.txt` files

Update `CMakeLists.txt` files to take into account commit 3289c07.
---
 CMakeLists.txt                   |  9 ++++++
 Common/CMakeLists.txt            | 50 ++++++++++++++------------------
 Inst_eddies/CMakeLists.txt       | 20 ++++++++-----
 Inst_eddies/Tests/CMakeLists.txt | 10 ++-----
 Overlap/CMakeLists.txt           | 10 +++++--
 Overlap/Tests/CMakeLists.txt     |  4 ++-
 6 files changed, 56 insertions(+), 47 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0befc604..6c994cd9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -30,6 +30,15 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES GNU)
   endif()
 endif()
 
+# test_write_eddy
+add_executable(test_write_eddy test_write_eddy.f90)
+target_link_libraries(test_write_eddy PRIVATE Shapelib_03::shapelib_03
+  Contour_531::contour_531 Jumble::jumble)
+set_target_properties(test_write_eddy PROPERTIES Fortran_MODULE_DIRECTORY
+  ${CMAKE_CURRENT_BINARY_DIR}/${my_target}_modules)
+target_include_directories(test_write_eddy PRIVATE
+  ${CMAKE_CURRENT_BINARY_DIR}/${my_target}_modules)
+
 add_subdirectory(Inst_eddies)
 add_subdirectory(Overlap)
 
diff --git a/Common/CMakeLists.txt b/Common/CMakeLists.txt
index 910d9ca5..9971726e 100644
--- a/Common/CMakeLists.txt
+++ b/Common/CMakeLists.txt
@@ -1,44 +1,36 @@
 add_subdirectory(Tests)
 target_sources(test_get_1_outerm PRIVATE derived_types.f90 get_slice_dir.f90
-  spher_polyline_area.f90 shpc_create.f90 write_eddy.f90 shpc_close.f90
-  ccw_orient.f90)
+  spher_polyline_area.f90 shpc_close.f90)
 target_sources(test_set_all_outerm PRIVATE derived_types.f90 get_slice_dir.f90
-  spher_polyline_area.f90 shpc_create.f90 write_eddy.f90 shpc_close.f90
-  ccw_orient.f90 write_snapshot.f90)
+  spher_polyline_area.f90 shpc_close.f90)
 target_sources(test_max_speed_contour_ssh PRIVATE derived_types.f90)
-target_sources(test_nearby_extr PRIVATE derived_types.f90 read_snapshot.f90
-  read_eddy.f90 read_field_indices.f90 shpc_open.f90 shpc_close.f90
-  get_slice_dir.f90 read_grid.F90)
+target_sources(test_nearby_extr PRIVATE derived_types.f90
+  read_field_indices.f90 shpc_open.f90 shpc_close.f90
+  get_slice_dir.f90)
 target_sources(test_set_max_speed PRIVATE derived_types.f90 get_slice_dir.f90
-  spher_polyline_area.f90 shpc_open.f90 shpc_close.f90 read_field_indices.f90
-  read_eddy.f90 shpc_create.f90 write_eddy.f90 ccw_orient.f90)
+  spher_polyline_area.f90 shpc_open.f90 shpc_close.f90 read_field_indices.f90)
 target_sources(test_spher_polyline_area PRIVATE spher_polyline_area.f90)
-target_sources(inst_eddies PRIVATE write_eddy.f90 spher_polyline_area.f90
-  derived_types.f90 shpc_create.f90 shpc_close.f90 shpc_open.f90
-  get_slice_dir.f90 read_field_indices.f90 write_snapshot.f90 ccw_orient.f90)
+target_sources(inst_eddies PRIVATE spher_polyline_area.f90
+  derived_types.f90 shpc_close.f90 shpc_open.f90
+  get_slice_dir.f90 read_field_indices.f90)
 target_sources(test_write_eddy PRIVATE derived_types.f90 shpc_open.f90
-  shpc_close.f90 read_field_indices.f90 shpc_create.f90 get_slice_dir.f90)
+  shpc_close.f90 read_field_indices.f90 get_slice_dir.f90)
 
 if(MPI_Fortran_HAVE_F08_MODULE)
-  target_sources(test_overlap PRIVATE derived_types.f90 read_snapshot.f90
-    spher_polyline_area.f90 read_eddy.f90 read_field_indices.f90 write_eddy.f90
-    shpc_open.f90 shpc_close.f90 get_slice_dir.f90 read_grid.F90)
-  target_sources(test_read_snapshot PRIVATE derived_types.f90 shpc_create.f90
-    read_snapshot.f90 write_eddy.f90 read_eddy.f90 read_field_indices.f90
-    shpc_open.f90 shpc_close.f90 get_slice_dir.f90 write_snapshot.f90)
+  target_sources(test_overlap PRIVATE derived_types.f90 spher_polyline_area.f90
+    read_field_indices.f90 shpc_open.f90 shpc_close.f90 get_slice_dir.f90)
+  target_sources(test_read_snapshot PRIVATE derived_types.f90
+    read_field_indices.f90
+    shpc_open.f90 shpc_close.f90 get_slice_dir.f90)
   target_sources(test_spher_polygon_area PRIVATE spher_polyline_area.f90)
-  target_sources(test_read_eddy PRIVATE derived_types.f90 shpc_create.f90
-    read_eddy.f90 write_eddy.f90 read_field_indices.f90 shpc_open.f90
+  target_sources(test_read_eddy PRIVATE derived_types.f90
+    read_field_indices.f90 shpc_open.f90
     shpc_close.f90 get_slice_dir.f90)
   target_sources(test_send_recv PRIVATE read_field_indices.f90
-    read_snapshot.f90 write_eddy.f90 shpc_create.f90 read_eddy.f90
-    derived_types.f90 shpc_open.f90 shpc_close.f90 get_slice_dir.f90
-    write_snapshot.f90)
+    derived_types.f90 shpc_open.f90 shpc_close.f90 get_slice_dir.f90)
   target_sources(test_get_dispatch_snap PRIVATE read_field_indices.f90
-    read_snapshot.f90 shpc_create.f90 write_eddy.f90 read_eddy.f90
-    derived_types.f90 shpc_open.f90 shpc_close.f90 get_slice_dir.f90
-    write_snapshot.f90)
+    derived_types.f90 shpc_open.f90 shpc_close.f90 get_slice_dir.f90)
   target_sources(eddy_graph PRIVATE shpc_open.f90 shpc_close.f90
-    read_field_indices.f90 read_snapshot.f90 spher_polyline_area.f90
-    read_eddy.f90 derived_types.f90 get_slice_dir.f90 read_grid.F90)
+    read_field_indices.f90 spher_polyline_area.f90
+    derived_types.f90 get_slice_dir.f90)
 endif()
diff --git a/Inst_eddies/CMakeLists.txt b/Inst_eddies/CMakeLists.txt
index e978fa09..5d42c1f2 100644
--- a/Inst_eddies/CMakeLists.txt
+++ b/Inst_eddies/CMakeLists.txt
@@ -2,7 +2,8 @@
 add_executable(inst_eddies inst_eddies.f90 local_extrema.f90 set_max_speed.f90
   get_1_outerm.f90 max_speed_contour_ssh.f90 good_contour.f90 mean_speed.f90
   inside_4.f90 set_all_outerm.f90 nearby_extr.f90 get_var.f90 config.f90
-  input_ssh.f90)
+  input_ssh.f90 shpc_create.f90 write_snapshot.f90 ccw_orient.f90
+  write_eddy.f90)
 target_link_libraries(inst_eddies PRIVATE Contour_531::contour_531
   Geometry::geometry NetCDF95::netcdf95 Shapelib_03::shapelib_03
   Numer_Rec_95::numer_rec_95 Jumble::jumble NetCDF_Fortran::netcdff)
@@ -18,10 +19,12 @@ file(COPY inst_eddies_Aviso.py DESTINATION . FILE_PERMISSIONS
 # Tests:
 add_subdirectory(Tests)
 target_sources(test_get_1_outerm PRIVATE get_1_outerm.f90 good_contour.f90
-  config.f90 input_ssh.f90 get_var.f90)
-target_sources(test_set_all_outerm PRIVATE set_all_outerm.f90
-  local_extrema.f90 get_1_outerm.f90 good_contour.f90 nearby_extr.f90
-  get_var.f90 config.f90 input_ssh.f90)
+  config.f90 input_ssh.f90 get_var.f90 shpc_create.f90 write_eddy.f90
+  ccw_orient.f90)
+target_sources(test_set_all_outerm PRIVATE set_all_outerm.f90 local_extrema.f90
+  get_1_outerm.f90 good_contour.f90 nearby_extr.f90 get_var.f90 config.f90
+  input_ssh.f90 shpc_create.f90 write_snapshot.f90 ccw_orient.f90
+  write_eddy.f90)
 target_sources(test_good_contour PRIVATE good_contour.f90)
 target_sources(test_inside_4 PRIVATE inside_4.f90)
 target_sources(test_mean_speed PRIVATE mean_speed.f90)
@@ -30,5 +33,8 @@ target_sources(test_max_speed_contour_ssh PRIVATE max_speed_contour_ssh.f90
 target_sources(test_nearby_extr PRIVATE nearby_extr.f90)
 target_sources(test_local_extrema PRIVATE local_extrema.f90)
 target_sources(test_set_max_speed PRIVATE set_max_speed.f90 good_contour.f90
-  max_speed_contour_ssh.f90 mean_speed.f90 inside_4.f90 get_var.f90
-  config.f90 input_ssh.f90)
+  max_speed_contour_ssh.f90 mean_speed.f90 inside_4.f90 get_var.f90 config.f90
+  input_ssh.f90 shpc_create.f90 ccw_orient.f90 write_eddy.f90)
+target_sources(test_write_eddy PRIVATE shpc_create.f90)
+add_executable(test_read_snapshot shpc_create.f90 write_snapshot.f90
+  write_eddy.f90)
diff --git a/Inst_eddies/Tests/CMakeLists.txt b/Inst_eddies/Tests/CMakeLists.txt
index acd92c41..02ac6f22 100644
--- a/Inst_eddies/Tests/CMakeLists.txt
+++ b/Inst_eddies/Tests/CMakeLists.txt
@@ -53,15 +53,9 @@ target_link_libraries(test_set_max_speed PRIVATE Geometry::geometry
   Shapelib_03::shapelib_03 Contour_531::contour_531 Jumble::jumble
   NetCDF_Fortran::netcdff gpc_f)
 
-# test_write_eddy
-add_executable(test_write_eddy test_write_eddy.f90)
-target_link_libraries(test_write_eddy PRIVATE Shapelib_03::shapelib_03
-  Contour_531::contour_531 Jumble::jumble)
-
 foreach(my_target IN ITEMS test_get_1_outerm test_set_all_outerm
-    test_good_contour test_inside_4 test_mean_speed
-    test_max_speed_contour_ssh test_nearby_extr test_local_extrema
-    test_set_max_speed test_write_eddy)
+    test_good_contour test_inside_4 test_mean_speed test_max_speed_contour_ssh
+    test_nearby_extr test_local_extrema test_set_max_speed)
   set_target_properties(${my_target} PROPERTIES Fortran_MODULE_DIRECTORY
     ${CMAKE_CURRENT_BINARY_DIR}/${my_target}_modules)
   target_include_directories(${my_target} PRIVATE
diff --git a/Overlap/CMakeLists.txt b/Overlap/CMakeLists.txt
index 0e3c5422..06be4a9a 100644
--- a/Overlap/CMakeLists.txt
+++ b/Overlap/CMakeLists.txt
@@ -6,7 +6,8 @@ if(MPI_Fortran_HAVE_F08_MODULE)
   # eddy_graph:
   add_executable(eddy_graph eddy_graph.f90 get_snapshot.f90 overlap.f90
     dispatch_snapshot.f90 recv_snapshot.f90 candidate_overlap.f90
-    spher_polygon_area.f90 send_snapshot.f90 unit_edge_m.f90 config_graph.F90)
+    spher_polygon_area.f90 send_snapshot.f90 unit_edge_m.f90 config_graph.F90
+    read_grid.F90 read_snapshot.f90 read_eddy.f90)
   target_link_libraries(eddy_graph PRIVATE EZMPI::ezmpi Jumble::jumble
     Shapelib_03::shapelib_03 Contour_531::contour_531 gpc_f Geometry::geometry
     MPI::MPI_Fortran Numer_Rec_95::numer_rec_95)
@@ -19,8 +20,13 @@ endif()
 
 add_subdirectory(Tests)
 target_sources(test_overlap PRIVATE overlap.f90 spher_polygon_area.f90
-  candidate_overlap.f90 unit_edge_m.f90 config_graph.F90)
+  candidate_overlap.f90 unit_edge_m.f90 config_graph.F90 read_grid.F90
+  read_snapshot.f90 read_eddy.f90)
 target_sources(test_spher_polygon_area PRIVATE spher_polygon_area.f90)
+target_sources(test_nearby_extr PRIVATE read_grid.F90 read_snapshot.f90
+  read_eddy.f90)
+target_sources(test_set_max_speed PRIVATE read_eddy.f90)
+target_sources(test_read_snapshot PRIVATE read_snapshot.f90 read_eddy.f90)
 
 if(MPI_Fortran_HAVE_F08_MODULE)
   target_sources(test_send_recv PRIVATE send_snapshot.f90 recv_snapshot.f90)
diff --git a/Overlap/Tests/CMakeLists.txt b/Overlap/Tests/CMakeLists.txt
index 3dff2f4a..90ad823f 100644
--- a/Overlap/Tests/CMakeLists.txt
+++ b/Overlap/Tests/CMakeLists.txt
@@ -2,9 +2,11 @@
 add_executable(test_overlap test_overlap.f90)
 target_link_libraries(test_overlap Shapelib_03::shapelib_03 Geometry::geometry
   Contour_531::contour_531 gpc_f Jumble::jumble Numer_Rec_95::numer_rec_95)
+target_compile_definitions(test_overlap PRIVATE SEQUENTIAL)
 
 # test_read_snapshot
-add_executable(test_read_snapshot test_read_snapshot.f90 save_snapshot.f90)
+target_sources(test_read_snapshot PRIVATE test_read_snapshot.f90
+  save_snapshot.f90)
 target_link_libraries(test_read_snapshot NetCDF95::netcdf95
   Shapelib_03::shapelib_03 Contour_531::contour_531 gpc_f
   Jumble::jumble NetCDF_Fortran::netcdff Numer_Rec_95::numer_rec_95)
-- 
GitLab