1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
Index: dolfinx/cpp/cmake/modules/FindPETSc.cmake
===================================================================
--- dolfinx.orig/cpp/cmake/modules/FindPETSc.cmake
+++ dolfinx/cpp/cmake/modules/FindPETSc.cmake
@@ -102,6 +102,14 @@ if (PETSC_FOUND AND NOT TARGET PETSC::pe
set_property(TARGET PETSC::petsc_static PROPERTY INTERFACE_LINK_LIBRARIES "${_libs}")
endif()
+# Add MPI variables if MPI has been found
+if (MPI_C_FOUND)
+ set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${MPI_C_INCLUDE_PATH})
+ set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${MPI_C_LIBRARIES})
+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${MPI_C_COMPILE_FLAGS}")
+ set(MPI_LINK_LIBRARIES MPI::MPI_C)
+endif()
+
# Attempt to build and run PETSc test program
if (DOLFINX_SKIP_BUILD_TESTS)
@@ -131,13 +139,6 @@ int main()
}
")
- # Add MPI variables if MPI has been found
- if (MPI_C_FOUND)
- set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${MPI_C_INCLUDE_PATH})
- set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${MPI_C_LIBRARIES})
- set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${MPI_C_COMPILE_FLAGS}")
- set(MPI_LINK_LIBRARIES MPI::MPI_C)
- endif()
# Try to run test program (shared linking)
try_run(
@@ -211,6 +212,7 @@ int main()
endif()
endif()
+
# Check sizeof(PetscInt) and check scalar type
if (PETSC_INCLUDE_DIRS)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${PETSC_INCLUDE_DIRS})
|