diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 4771d19b51..3213da02db 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -188,9 +188,10 @@ if(BUILD_MPI) include(MPI4WIN) target_link_libraries(lammps PUBLIC LAMMPS::MPI) else() + set(MPI_CXX_SKIP_MPICXX ON) find_package(MPI REQUIRED) - target_compile_definitions(lammps PRIVATE -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1) target_link_libraries(lammps PUBLIC MPI::MPI_CXX) + set_target_properties(MPI::MPI_CXX PROPERTIES IMPORTED_GLOBAL TRUE) add_library(LAMMPS::MPI ALIAS MPI::MPI_CXX) option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF) if(LAMMPS_LONGLONG_TO_LONG)