From: Matthias Maier <tamiko@kyomu.43-1.org>
Date: Thu, 11 Jul 2013 17:23:17 +0000 (+0000)
Subject: CMake: One more round to get a sane link interface *yay*
X-Git-Tag: v8.0.0~147
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b82bd4817c55d1ccdc247aeafd1d9d2a714ddb81;p=dealii.git

CMake: One more round to get a sane link interface *yay*

git-svn-id: https://svn.dealii.org/trunk@29974 0785d39b-7218-0410-832d-ea1e28bc413d
---

diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt
index b665897d70..e193114c9a 100644
--- a/deal.II/CMakeLists.txt
+++ b/deal.II/CMakeLists.txt
@@ -66,7 +66,7 @@ INCLUDE(setup_cached_variables)
 #
 # Now, set the project and set up the rest:
 #
-PROJECT(deal.II)
+PROJECT(deal.II CXX C)
 INCLUDE(setup_deal_ii)
 INCLUDE(setup_compiler_flags)
 
diff --git a/deal.II/cmake/configure/configure_1_mpi.cmake b/deal.II/cmake/configure/configure_1_mpi.cmake
index e0c1766d41..da78dfd05f 100644
--- a/deal.II/cmake/configure/configure_1_mpi.cmake
+++ b/deal.II/cmake/configure/configure_1_mpi.cmake
@@ -17,6 +17,13 @@
 #
 
 MACRO(FEATURE_MPI_FIND_EXTERNAL var)
+  #
+  # Enable Fortran support so that MPI_Fortran_LIBRARIES is set up.
+  #
+  IF(NOT CMAKE_Fortran_COMPILER_WORKS)
+    ENABLE_LANGUAGE(Fortran OPTIONAL)
+  ENDIF()
+
   #
   # Obey a manual user override: If MPI_CXX_FOUND is set to true in the
   # cache, we skip the FIND_PACKAGE calls:
diff --git a/deal.II/cmake/modules/FindMETIS.cmake b/deal.II/cmake/modules/FindMETIS.cmake
index 8829c8b06b..be83ff3e89 100644
--- a/deal.II/cmake/modules/FindMETIS.cmake
+++ b/deal.II/cmake/modules/FindMETIS.cmake
@@ -26,9 +26,11 @@ INCLUDE(FindPackageHandleStandardArgs)
 SET_IF_EMPTY(METIS_DIR "$ENV{METIS_DIR}")
 
 #
-# TODO: Metis is usually pretty self contained. So no external dependencies
+# Metis is usually pretty self contained. So no external dependencies
 # so far... But there could be dependencies on pcre and mpi...
 #
+# Link in MPI unconditionally (if found)
+#
 
 FIND_PATH(METIS_INCLUDE_DIR metis.h
   HINTS
@@ -55,7 +57,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(METIS DEFAULT_MSG
 IF(METIS_FOUND)
   SET(METIS_LIBRARIES
     ${METIS_LIBRARY}
-    ${MPI_CXX_LIBRARIES} # for good measure
+    ${MPI_C_LIBRARIES} # for good measure
     )
   SET(METIS_INCLUDE_DIRS ${METIS_INCLUDE_DIR})
 
diff --git a/deal.II/cmake/modules/FindMUMPS.cmake b/deal.II/cmake/modules/FindMUMPS.cmake
index 0a3299c541..22ee16a703 100644
--- a/deal.II/cmake/modules/FindMUMPS.cmake
+++ b/deal.II/cmake/modules/FindMUMPS.cmake
@@ -91,7 +91,7 @@ IF(MUMPS_FOUND)
     ${MUMPS_COMMON_LIBRARY}
     ${PORD_LIBRARY}
     ${SCALAPACK_LIBRARIES}
-    ${MPI_CXX_LIBRARIES} # For good measure
+    ${MPI_Fortran_LIBRARIES} # For good measure
     )
   SET(MUMPS_LINKER_FLAGS
     ${SCALAPACK_LINKER_FLAGS}
diff --git a/deal.II/cmake/modules/FindP4EST.cmake b/deal.II/cmake/modules/FindP4EST.cmake
index 93cf297f70..3aad02abdf 100644
--- a/deal.II/cmake/modules/FindP4EST.cmake
+++ b/deal.II/cmake/modules/FindP4EST.cmake
@@ -92,7 +92,7 @@ IF(P4EST_FOUND)
   SET(P4EST_LIBRARIES
     ${P4EST_LIBRARY}
     ${SC_LIBRARY}
-    ${MPI_CXX_LIBRARIES} # for good measure
+    ${MPI_C_LIBRARIES} # for good measure
     )
   SET(P4EST_INCLUDE_DIRS
     ${P4EST_INCLUDE_DIR}
diff --git a/deal.II/cmake/modules/FindUMFPACK.cmake b/deal.II/cmake/modules/FindUMFPACK.cmake
index a8cb4a4871..fc512a52f3 100644
--- a/deal.II/cmake/modules/FindUMFPACK.cmake
+++ b/deal.II/cmake/modules/FindUMFPACK.cmake
@@ -35,6 +35,7 @@ ENDFOREACH()
 # now.
 #
 FIND_PACKAGE(LAPACK)
+FIND_PACKAGE(METIS)
 
 #
 # Two macros to make life easier:
@@ -128,10 +129,17 @@ IF(UMFPACK_FOUND)
     ${CAMD_LIBRARY}
     ${AMD_LIBRARY}
     ${SuiteSparse_config_LIBRARY}
-    ${METIS_LIBRARIES} # for good measure
-    ${LAPACK_LIBRARIES}
     )
 
+  #
+  # For good measure:
+  #
+  IF(METIS_FOUND)
+    LIST(APPEND UMFPACK_LIBRARIES ${METIS_LIBRARIES})
+  ENDIF()
+
+  LIST(APPEND UMFPACK_LIBRARIES ${LAPACK_LIBRARIES})
+
   #
   # Add rt to the link interface as well (for whatever reason,
   # libsuitesparse.so depends on clock_gettime but the shared