From d4fc84d4997e90f1ceab1adf64cf76c3a1b1a02a Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Fri, 15 Mar 2024 14:54:18 -0400 Subject: [PATCH] Fix up MPI detection for Spack builds --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fc2dc3fa..f78a130f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,12 +38,16 @@ foreach (dir cmake @cmake cmake@) set (ESMA_CMAKE_PATH "${CMAKE_CURRENT_LIST_DIR}/${dir}" CACHE PATH "Path to ESMA_cmake code") endif () endforeach () + +# We need to find MPI before we go into esma +# for the MPI stack detection to work +set(MPI_DETERMINE_LIBRARY_VERSION TRUE) +find_package(MPI) + include (esma) # Add CMake for when not using Baselibs if (NOT Baselibs_FOUND) - set(MPI_DETERMINE_LIBRARY_VERSION TRUE) - find_package(MPI) find_package(NetCDF REQUIRED C Fortran) add_definitions(-DHAS_NETCDF4)