From 67aa5a0e646e1f2e2cfb29924133ff73c1589010 Mon Sep 17 00:00:00 2001 From: Nicolas Cornu Date: Tue, 30 Apr 2024 17:19:13 +0200 Subject: [PATCH] use MPI::MPI_CXX --- cmake/MacroHelper.cmake | 4 ++-- src/coreneuron/CMakeLists.txt | 2 +- src/nrniv/CMakeLists.txt | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cmake/MacroHelper.cmake b/cmake/MacroHelper.cmake index 4da8553114..50291e0353 100644 --- a/cmake/MacroHelper.cmake +++ b/cmake/MacroHelper.cmake @@ -189,13 +189,13 @@ macro(nrn_mpi_find_package) AND NRN_ENABLE_MPI_DYNAMIC) set(_temp ${CMAKE_OSX_ARCHITECTURES}) unset(CMAKE_OSX_ARCHITECTURES CACHE) - find_package(MPI REQUIRED COMPONENTS C) + find_package(MPI REQUIRED) set(CMAKE_OSX_ARCHITECTURES ${_temp} CACHE INTERNAL "" FORCE) set(NRN_UNIVERSAL2_BUILD ON) else() - find_package(MPI REQUIRED COMPONENTS C) + find_package(MPI REQUIRED) endif() endmacro() diff --git a/src/coreneuron/CMakeLists.txt b/src/coreneuron/CMakeLists.txt index 286aefacc0..a94ecd7366 100644 --- a/src/coreneuron/CMakeLists.txt +++ b/src/coreneuron/CMakeLists.txt @@ -492,7 +492,7 @@ endforeach() # we can link to MPI libraries in non-dynamic-mpi build if(NRN_ENABLE_MPI AND NOT NRN_ENABLE_MPI_DYNAMIC) - target_link_libraries(coreneuron-core PUBLIC ${MPI_C_LIBRARIES}) + target_link_libraries(coreneuron-core PUBLIC MPI::MPI_CXX) endif() # ~~~ diff --git a/src/nrniv/CMakeLists.txt b/src/nrniv/CMakeLists.txt index 578be1dd92..7b794b3705 100644 --- a/src/nrniv/CMakeLists.txt +++ b/src/nrniv/CMakeLists.txt @@ -470,7 +470,7 @@ if(NRN_ENABLE_MPI) # Note that we do not link here to libmpi. That is dlopen first. if(MINGW) # type msmpi only add_dependencies(${libname}_lib nrniv_lib) - target_link_libraries(${libname}_lib ${MPI_C_LIBRARIES}) + target_link_libraries(${libname}_lib MPI::MPI_CXX) target_link_libraries(${libname}_lib nrniv_lib) endif() set_property(TARGET ${libname}_lib PROPERTY OUTPUT_NAME ${libname}) @@ -490,8 +490,7 @@ if(NRN_ENABLE_MPI) install(TARGETS ${libnrnmusic}_lib DESTINATION ${NRN_INSTALL_SHARE_LIB_DIR}) endif() else() - target_link_libraries(nrniv_lib ${MPI_C_LIBRARIES}) - target_include_directories(nrniv_lib PUBLIC ${MPI_INCLUDE_PATH}) + target_link_libraries(nrniv_lib MPI::MPI_CXX) endif() endif()