Update MPI dependence for `gmxapi` target.
authorM. Eric Irrgang <ericirrgang@gmail.com>
Tue, 21 Sep 2021 13:01:22 +0000 (16:01 +0300)
committerMark Abraham <mark.j.abraham@gmail.com>
Wed, 22 Sep 2021 19:30:45 +0000 (19:30 +0000)
Use the `MPI::MPI_CXX` target instead of deprecated FindMPI output variables.

Ref #3672.

api/gmxapi/CMakeLists.txt

index a4caed9e66443b4cb345774099223d863d86b7fd..1683fc8ae4f3028bedfbfce7cf72f3aed4bf1cec 100644 (file)
@@ -65,11 +65,7 @@ set_target_properties(gmxapi PROPERTIES
 if (GMX_LIB_MPI)
     # GROMACS is built against an MPI library.
     set(_gmx_mpi_type "library")
-    # TODO(#3672): Normative solution with #3672.
-    # Do not target_link_options(gmxapi PRIVATE ${MPI_CXX_LINK_FLAGS})
-    # because the root CMakeLists.txt sets CMAKE_SHARED_LINKER_FLAGS.
-    target_compile_options(gmxapi PUBLIC ${MPI_COMPILE_FLAGS})
-    target_link_libraries(gmxapi PUBLIC ${MPI_CXX_LIBRARIES})
+    target_link_libraries(gmxapi PRIVATE MPI::MPI_CXX)
 elseif(GMX_THREAD_MPI)
     # GROMACS is built with its internal thread-MPI implementation.
     set(_gmx_mpi_type "tmpi")