forked from lijiext/lammps
cmake: fix MPI linkage
This commit is contained in:
parent
3806222e04
commit
119ba61c09
|
@ -190,6 +190,7 @@ if(BUILD_MPI)
|
|||
find_package(MPI REQUIRED)
|
||||
target_compile_definitions(lammps PRIVATE -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1)
|
||||
target_link_libraries(lammps PUBLIC MPI::MPI_CXX)
|
||||
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)
|
||||
target_compile_definitions(lammps PRIVATE -DLAMMPS_LONGLONG_TO_LONG)
|
||||
|
@ -211,7 +212,7 @@ else()
|
|||
else()
|
||||
target_link_libraries(lammps PUBLIC mpi_stubs)
|
||||
endif()
|
||||
add_library(MPI::MPI_CXX ALIAS mpi_stubs)
|
||||
add_library(LAMMPS::MPI ALIAS mpi_stubs)
|
||||
endif()
|
||||
|
||||
set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)")
|
||||
|
@ -488,7 +489,7 @@ if(PKG_USER-ATC)
|
|||
if(LAMMPS_SIZES STREQUAL BIGBIG)
|
||||
message(FATAL_ERROR "The USER-ATC Package is not compatible with -DLAMMPS_BIGBIG")
|
||||
endif()
|
||||
target_link_libraries(atc PRIVATE ${LAPACK_LIBRARIES} MPI::MPI_CXX)
|
||||
target_link_libraries(atc PRIVATE ${LAPACK_LIBRARIES} LAMMPS::MPI)
|
||||
target_include_directories(atc PRIVATE ${LAMMPS_SOURCE_DIR})
|
||||
target_compile_definitions(atc PRIVATE -DLAMMPS_${LAMMPS_SIZES})
|
||||
endif()
|
||||
|
|
|
@ -192,7 +192,7 @@ if(PKG_GPU)
|
|||
|
||||
get_property(GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES)
|
||||
|
||||
target_link_libraries(gpu PRIVATE MPI::MPI_CXX)
|
||||
target_link_libraries(gpu PRIVATE LAMMPS::MPI)
|
||||
if(BUILD_LIB AND NOT BUILD_SHARED_LIBS)
|
||||
install(TARGETS gpu EXPORT LAMMPS_Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
|
|
@ -15,7 +15,7 @@ if(PKG_MESSAGE)
|
|||
if(BUILD_MPI)
|
||||
target_compile_definitions(cslib PRIVATE -DMPI_YES)
|
||||
set_target_properties(cslib PROPERTIES OUTPUT_NAME "csmpi")
|
||||
target_link_libraries(cslib PRIVATE MPI::MPI_CXX)
|
||||
target_link_libraries(cslib PRIVATE LAMMPS::MPI)
|
||||
else()
|
||||
target_compile_definitions(cslib PRIVATE -DMPI_NO)
|
||||
target_include_directories(cslib PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/message/cslib/src/STUBS_MPI)
|
||||
|
|
Loading…
Reference in New Issue