From 05cbb2eaf26afc27cd0d20c9e38d6057e35b452a Mon Sep 17 00:00:00 2001 From: James Foucar Date: Mon, 9 Oct 2023 15:13:54 -0600 Subject: [PATCH] Fix PIO dep on mpi-serial PIO needs to depend on mpi-serial in order for the link order to be correct. [BFB] --- components/cmake/build_model.cmake | 7 +------ components/cmake/modules/FindPIO.cmake | 6 +++++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/components/cmake/build_model.cmake b/components/cmake/build_model.cmake index 17624ab86905..1615fba9bb03 100644 --- a/components/cmake/build_model.cmake +++ b/components/cmake/build_model.cmake @@ -207,11 +207,6 @@ function(build_model COMP_CLASS COMP_NAME) # build rules: #------------------------------------------------------------------------------- - if (MPILIB STREQUAL "mpi-serial") - set(MPISERIAL "${INSTALL_SHAREDPATH}/lib/libmpi-serial.a") - set(MLIBS "${MLIBS} ${MPISERIAL}") - endif() - foreach(ITEM IN LISTS SOURCES) if (ITEM MATCHES "${CMAKE_BINARY_DIR}/.*") # is generated list(APPEND REAL_SOURCES ${ITEM}) @@ -225,7 +220,7 @@ function(build_model COMP_CLASS COMP_NAME) add_executable(${TARGET_NAME}) target_sources(${TARGET_NAME} PRIVATE ${REAL_SOURCES}) - set(ALL_LIBS "${GPTLLIB} ${SLIBS} ${MLIBS}") + set(ALL_LIBS "${GPTLLIB} ${SLIBS}") separate_arguments(ALL_LIBS_LIST UNIX_COMMAND "${ALL_LIBS}") foreach(ITEM IN LISTS COMP_CLASSES) diff --git a/components/cmake/modules/FindPIO.cmake b/components/cmake/modules/FindPIO.cmake index 48077caf1c82..3176f39f2b59 100644 --- a/components/cmake/modules/FindPIO.cmake +++ b/components/cmake/modules/FindPIO.cmake @@ -28,7 +28,7 @@ find_package(NETCDF REQUIRED) # Not all machines/PIO installations use ADIOS but, for now, # we can assume that an MPI case with ADIOS2_ROOT set is probably # using adios. -if (NOT MPILIB STREQUAL mpi-serial AND DEFINED ENV{ADIOS2_ROOT}) +if (NOT MPILIB STREQUAL "mpi-serial" AND DEFINED ENV{ADIOS2_ROOT}) find_package(MPI REQUIRED COMPONENTS C) find_package(ADIOS2 REQUIRED COMPONENTS C) list(APPEND PIOLIBS adios2::adios2) @@ -36,6 +36,10 @@ endif() list(APPEND PIOLIBS netcdf) +if (MPILIB STREQUAL "mpi-serial") + list(APPEND PIOLIBS "${INSTALL_SHAREDPATH}/lib/libmpi-serial.a") +endif() + # Create the interface library, and set target properties add_library(spio INTERFACE) target_link_libraries(spio INTERFACE ${PIOLIBS})