From baf6ede25c789a345d2d34481400db4e81bca5cc Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Tue, 4 Jan 2022 23:08:30 +0100 Subject: [PATCH] `add_subdirectory` Tests instead of include --- Overlap/CMakeLists.txt | 9 ++++++++- Overlap/Tests/CMakeLists.txt | 39 ++++++++---------------------------- 2 files changed, 16 insertions(+), 32 deletions(-) diff --git a/Overlap/CMakeLists.txt b/Overlap/CMakeLists.txt index 7eec5cf8..7d2de955 100644 --- a/Overlap/CMakeLists.txt +++ b/Overlap/CMakeLists.txt @@ -11,4 +11,11 @@ target_link_libraries(eddy_graph PRIVATE EZMPI::ezmpi Jumble::jumble configure_file(eddy_graph.sh.in eddy_graph.sh @ONLY FILE_PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) -include(Tests/CMakeLists.txt) +add_subdirectory(Tests) +target_sources(test_overlap PRIVATE overlap.f90 spher_polygon_area.f90 + weight.f90 candidate_overlap.f90 unit_edge_m.f90) +target_sources(test_spher_polygon_area PRIVATE spher_polygon_area.f90) +target_sources(test_weight PRIVATE weight.f90) +target_sources(test_send_recv PRIVATE send_snapshot.f90 recv_snapshot.f90) +target_sources(test_get_dispatch_snap PRIVATE get_snapshot.f90 + dispatch_snapshot.f90 recv_snapshot.f90 send_snapshot.f90) diff --git a/Overlap/Tests/CMakeLists.txt b/Overlap/Tests/CMakeLists.txt index c1cca26f..dfc19f40 100644 --- a/Overlap/Tests/CMakeLists.txt +++ b/Overlap/Tests/CMakeLists.txt @@ -1,61 +1,38 @@ # test_overlap -add_executable(test_overlap - overlap.f90 - spher_polygon_area.f90 - weight.f90 - candidate_overlap.f90 - ${CMAKE_CURRENT_LIST_DIR}/test_overlap.f90 - unit_edge_m.f90) +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) # test_read_snapshot -add_executable(test_read_snapshot - ${CMAKE_CURRENT_LIST_DIR}/test_read_snapshot.f90 - ${CMAKE_CURRENT_LIST_DIR}/write_snapshot.f90 - ) +add_executable(test_read_snapshot test_read_snapshot.f90 write_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) # test_spher_polygon_area -add_executable(test_spher_polygon_area spher_polygon_area.f90 - ${CMAKE_CURRENT_LIST_DIR}/test_spher_polygon_area.f90) +add_executable(test_spher_polygon_area test_spher_polygon_area.f90) target_link_libraries(test_spher_polygon_area Geometry::geometry Shapelib_03::shapelib_03 Jumble::jumble gpc_f) # test_weight -add_executable(test_weight weight.f90 - ${CMAKE_CURRENT_LIST_DIR}/test_weight.f90) +add_executable(test_weight test_weight.f90) target_link_libraries(test_weight PRIVATE fortrangis::fortranGIS Contour_531::contour_531 Jumble::jumble) # test_read_eddy -add_executable(test_read_eddy - ${CMAKE_CURRENT_LIST_DIR}/test_read_eddy.f90 - ) +add_executable(test_read_eddy test_read_eddy.f90) target_link_libraries(test_read_eddy Shapelib_03::shapelib_03 Contour_531::contour_531 gpc_f Jumble::jumble) # test_send_recv -add_executable(test_send_recv - ${CMAKE_CURRENT_LIST_DIR}/test_send_recv.f90 send_snapshot.f90 - recv_snapshot.f90 - ${CMAKE_CURRENT_LIST_DIR}/write_snapshot.f90 - ) - +add_executable(test_send_recv test_send_recv.f90 write_snapshot.f90) target_link_libraries(test_send_recv PRIVATE MPI::MPI_Fortran Shapelib_03::shapelib_03 EZMPI::ezmpi Contour_531::contour_531 gpc_f NetCDF95::netcdf95 Jumble::jumble NetCDF_Fortran::netcdff) # test_get_dispatch_snap -add_executable(test_get_dispatch_snap - ${CMAKE_CURRENT_LIST_DIR}/test_get_dispatch_snap.f90 - get_snapshot.f90 dispatch_snapshot.f90 - ${CMAKE_CURRENT_LIST_DIR}/write_snapshot.f90 - recv_snapshot.f90 - send_snapshot.f90 - ) +add_executable(test_get_dispatch_snap test_get_dispatch_snap.f90 + write_snapshot.f90) target_link_libraries(test_get_dispatch_snap Shapelib_03::shapelib_03 Jumble::jumble Contour_531::contour_531 EZMPI::ezmpi NetCDF95::netcdf95 gpc_f NetCDF_Fortran::netcdff MPI::MPI_Fortran) -- GitLab