]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Workaround: Ensure "mpiuni/mpi.h" is reachable 4158/head
authorMatthias Maier <tamiko@43-1.org>
Thu, 30 Mar 2017 22:38:47 +0000 (17:38 -0500)
committerMatthias Maier <tamiko@43-1.org>
Fri, 31 Mar 2017 13:53:06 +0000 (08:53 -0500)
In case of a sequential build without mpi support and sequential petsc a
dummy mpi.h file installed by petsc must be reachable in from our final
set of include directories.

Normally this is not an issue - petsc exports such information in the
file "petscvariables" that we parse. But some distributions have chosen
to not install this file...

Closes #4157

cmake/modules/FindPETSC.cmake

index dccc9f6084d5381cb0633c260bfb394fd9b0b9cd..690d82c3c30dbbbf1954b580c38d4b6e2cc31abd 100644 (file)
@@ -197,16 +197,29 @@ IF(NOT PETSC_PETSCVARIABLES MATCHES "-NOTFOUND")
   ENDFOREACH()
 ENDIF()
 
+IF(PETSC_WITH_MPIUNI)
+  #
+  # Workaround: Some distributions happen to not install petscvariables and
+  # we consequently might miss some essential include directories. Let's
+  # try at least to find the mpiuni include directory.
+  #
+  DEAL_II_FIND_PATH(PETSC_INCLUDE_DIR_MPIUNI mpiuni/mpi.h
+    HINTS ${PETSC_INCLUDE_DIR_COMMON} ${PETSC_INCLUDE_DIR_ARCH} ${_petsc_includes}
+    PATH_SUFFIXES petsc
+    )
+  SET(PETSC_INCLUDE_DIR_MPIUNI "${PETSC_INCLUDE_DIR_MPIUNI}/mpiuni")
+ENDIF()
+
 DEAL_II_PACKAGE_HANDLE(PETSC
   LIBRARIES
     REQUIRED PETSC_LIBRARY
     OPTIONAL _petsc_libraries
   INCLUDE_DIRS
     REQUIRED PETSC_INCLUDE_DIR_COMMON PETSC_INCLUDE_DIR_ARCH
-    OPTIONAL _petsc_includes
+    OPTIONAL PETSC_INCLUDE_DIR_MPIUNI _petsc_includes
   USER_INCLUDE_DIRS
     REQUIRED PETSC_INCLUDE_DIR_COMMON PETSC_INCLUDE_DIR_ARCH
-    OPTIONAL _petsc_includes
+    OPTIONAL PETSC_INCLUDE_DIR_MPIUNI _petsc_includes
   CLEAR
     PETSC_LIBRARY PETSC_INCLUDE_DIR_COMMON PETSC_INCLUDE_DIR_ARCH
     PETSC_PETSCVARIABLES ${_cleanup_variables}

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.