]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Code refactoring
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 27 Feb 2013 17:21:29 +0000 (17:21 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 27 Feb 2013 17:21:29 +0000 (17:21 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_cmake@28618 0785d39b-7218-0410-832d-ea1e28bc413d

17 files changed:
deal.II/cmake/configure/configure_1_mpi.cmake
deal.II/cmake/configure/configure_1_threads.cmake
deal.II/cmake/configure/configure_arpack.cmake
deal.II/cmake/configure/configure_boost.cmake
deal.II/cmake/configure/configure_functionparser.cmake
deal.II/cmake/configure/configure_hdf5.cmake
deal.II/cmake/configure/configure_metis.cmake
deal.II/cmake/configure/configure_mumps.cmake
deal.II/cmake/configure/configure_netcdf.cmake
deal.II/cmake/configure/configure_p4est.cmake
deal.II/cmake/configure/configure_petsc.cmake
deal.II/cmake/configure/configure_slepc.cmake
deal.II/cmake/configure/configure_trilinos.cmake
deal.II/cmake/configure/configure_umfpack.cmake
deal.II/cmake/configure/configure_zlib.cmake
deal.II/cmake/macros/macro_configure_feature.cmake
deal.II/doc/development/cmake.html

index d7e4a0d85409cdf2ba1029ae15be9f9659404130..1859962f695e6910340501cab8376f0b4573f98c 100644 (file)
@@ -58,9 +58,6 @@ MACRO(FEATURE_MPI_CONFIGURE_EXTERNAL var)
 ENDMACRO()
 
 
-SET(FEATURE_MPI_CUSTOM_ERROR_MESSAGE TRUE)
-
-
 MACRO(FEATURE_MPI_ERROR_MESSAGE)
   MESSAGE(FATAL_ERROR "\n"
     "Could not find any suitable mpi library!\n"
index 5a69e99707fd498b15c1c989fcc168934c007bb6..9aad0ffdaa7964bd4945c8a4b7677e22c60279bd 100644 (file)
@@ -38,7 +38,7 @@ MACRO(SETUP_THREADING var)
     SET(DEAL_II_USE_MT TRUE)
 
     #
-    # Change -lphtread to -pthread for more compatibility on non linux
+    # Change -lphtread to -pthread for better compatibility on non linux
     # platforms:
     #
     IF("${CMAKE_THREAD_LIBS_INIT}" MATCHES "-lpthread")
@@ -90,7 +90,6 @@ MACRO(SETUP_THREADING var)
 ENDMACRO()
 
 
-
 #
 # Set up the tbb library:
 #
index 6e4ef1ef0e94eb5a93fbbd3e521f4f2da009c3ee..70a427f778c562073f1539cdcf12756ad11c6858 100644 (file)
 #
 
 
-MACRO(FEATURE_ARPACK_FIND_EXTERNAL var)
-  FIND_PACKAGE(ARPACK)
-
-  IF(ARPACK_FOUND)
-    SET(${var} TRUE)
-  ENDIF()
-ENDMACRO()
-
-
 MACRO(FEATURE_ARPACK_CONFIGURE_EXTERNAL var)
   LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${ARPACK_LIBRARIES})
   ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${ARPACK_LINKER_FLAGS}")
index c26b03a09398b2e3858d489e6b7dd8d2c296f243..fc1f48436edfda2cff8f20eb1536184461299538 100644 (file)
@@ -40,7 +40,7 @@ MACRO(FEATURE_BOOST_FIND_EXTERNAL var)
   #
   # We require at least version 1.44
   #
-  FIND_PACKAGE (Boost 1.44 COMPONENTS serialization thread)
+  FIND_PACKAGE(Boost 1.44 COMPONENTS serialization thread)
 
   IF(Boost_THREAD_FOUND AND Boost_SERIALIZATION_FOUND)
     SET(${var} TRUE)
index ad92d512282590af0b7301c4900dcd1ff7a6cb1b..3276db0b30384d89b38eb0c95c07212a3c602139 100644 (file)
@@ -34,9 +34,6 @@ MACRO(FEATURE_FUNCTIONPARSER_CONFIGURE_BUNDLED var)
 ENDMACRO()
 
 
-SET(FEATURE_FUNCTIONPARSER_CUSTOM_ERROR_MESSAGE TRUE)
-
-
 MACRO(FEATURE_FUNCTIONPARSER_ERROR_MESSAGE)
   MESSAGE(FATAL_ERROR "\n"
     "No module available for finding functionparser externally.\n"
index f77a4add115ad426c15bf498bc804b495dae0636..2f0ff3e937ca58290e8083c9cc468dad2c98f991 100644 (file)
 #
 
 
-MACRO(FEATURE_HDF5_FIND_EXTERNAL var)
-  FIND_PACKAGE(HDF5)
-
-  IF(HDF5_FOUND)
-      SET(${var} TRUE)
-  ENDIF()
-ENDMACRO()
-
-
 MACRO(FEATURE_HDF5_CONFIGURE_EXTERNAL var)
   INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIRS})
   LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${HDF5_LIBRARIES})
@@ -36,9 +27,6 @@ MACRO(FEATURE_HDF5_CONFIGURE_EXTERNAL var)
 ENDMACRO()
 
 
-SET(FEATURE_HDF5_CUSTOM_ERROR_MESSAGE TRUE)
-
-
 MACRO(FEATURE_HDF5_ERROR_MESSAGE)
   MESSAGE(FATAL_ERROR "\n"
     "Could not find the hdf5 library!\n"
index a6e1419d6ad5612597afe55bac74dfb156c31ca2..b051ee212005d2b674ed3bd10e2ed0bdb6644f4f 100644 (file)
@@ -47,9 +47,6 @@ MACRO(FEATURE_METIS_CONFIGURE_EXTERNAL var)
 ENDMACRO()
 
 
-SET(FEATURE_METIS_CUSTOM_ERROR_MESSAGE TRUE)
-
-
 MACRO(FEATURE_METIS_ERROR_MESSAGE)
   MESSAGE(FATAL_ERROR "\n"
     "Could not find the metis library!\n"
index 05f25a0434c5526ed7dcb6d6a1e9a44c6ec2f752..b45381ba38b5de410eb19102eabff7b4ad86e64b 100644 (file)
 SET(FEATURE_MUMPS_DEPENDS DEAL_II_WITH_MPI)
 
 
-MACRO(FEATURE_MUMPS_FIND_EXTERNAL var)
-  FIND_PACKAGE(MUMPS)
-
-  IF(MUMPS_FOUND)
-    SET(${var} TRUE)
-  ENDIF()
-ENDMACRO()
-
-
 MACRO(FEATURE_MUMPS_CONFIGURE_EXTERNAL var)
   INCLUDE_DIRECTORIES(${MUMPS_INCLUDE_DIRS})
   LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES
@@ -43,9 +34,6 @@ MACRO(FEATURE_MUMPS_CONFIGURE_EXTERNAL var)
 ENDMACRO()
 
 
-SET(FEATURE_MUMPS_CUSTOM_ERROR_MESSAGE TRUE)
-
-
 MACRO(FEATURE_MUMPS_ERROR_MESSAGE)
   MESSAGE(FATAL_ERROR "\n"
     "Could not find the mumps library!\n"
index e2d7044e30183135132850888f46d2654082fdf1..9a9344b2626b8078151ef7bd86d9bf5440fb602d 100644 (file)
 #
 
 
-MACRO(FEATURE_NETCDF_FIND_EXTERNAL var)
-  FIND_PACKAGE(NETCDF)
-
-  IF(NETCDF_FOUND)
-    SET(${var} TRUE)
-  ENDIF()
-ENDMACRO()
-
-
 MACRO(FEATURE_NETCDF_CONFIGURE_EXTERNAL var)
   INCLUDE_DIRECTORIES(${NETCDF_INCLUDE_DIRS})
   LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${NETCDF_LIBRARIES})
index 028ca79a9496ec1d646bd80bcf10d32ce7d36467..b26cfdbb8df721d320463d61101bbd981cdc1966 100644 (file)
@@ -54,9 +54,6 @@ MACRO(FEATURE_P4EST_CONFIGURE_EXTERNAL var)
 ENDMACRO()
 
 
-SET(FEATURE_P4EST_CUSTOM_ERROR_MESSAGE TRUE)
-
-
 MACRO(FEATURE_P4EST_ERROR_MESSAGE)
   MESSAGE(FATAL_ERROR "\n"
     "Could not find the p4est and sc libraries!\n"
index 1b3f67c30c71fddc5971779e9a8ce798c537993a..92d7440614878d47a663fd9532817fb01daac8de 100644 (file)
@@ -95,9 +95,6 @@ MACRO(FEATURE_PETSC_CONFIGURE_EXTERNAL var)
 ENDMACRO()
 
 
-SET(FEATURE_PETSC_CUSTOM_ERROR_MESSAGE TRUE)
-
-
 MACRO(FEATURE_PETSC_ERROR_MESSAGE)
   MESSAGE(FATAL_ERROR "\n"
     "Could not find the petsc library!\n"
index 0f66434eed9da7845198f252165f848b71eb5c59..8f4fe2d0d48c1d8985e9b69d962bd85fa3d8c928 100644 (file)
@@ -63,9 +63,6 @@ MACRO(FEATURE_SLEPC_CONFIGURE_EXTERNAL var)
 ENDMACRO()
 
 
-SET(FEATURE_SLEPC_CUSTOM_ERROR_MESSAGE TRUE)
-
-
 MACRO(FEATURE_SLEPC_ERROR_MESSAGE)
   MESSAGE(FATAL_ERROR "\n"
     "Could not find the SLEPc library!\n"
@@ -85,4 +82,3 @@ ENDMACRO()
 
 
 CONFIGURE_FEATURE(SLEPC)
-
index 0783c48c9d0acad0333805fbcfae4a702a6856a3..ee1f523f0ebc49870dfce9ba1fef600ef6639196 100644 (file)
@@ -199,9 +199,6 @@ MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL var)
 ENDMACRO()
 
 
-SET(FEATURE_TRILINOS_CUSTOM_ERROR_MESSAGE TRUE)
-
-
 MACRO(FEATURE_TRILINOS_ERROR_MESSAGE)
   MESSAGE(FATAL_ERROR "\n"
     "Could not find a suitable set of trilinos libraries!\n"
index f83c683742426d8a1fa850f011a11a726bbb3e41..529be4d846a7d01105f9e4fc365e7728d7f2c998 100644 (file)
 SET(FEATURE_UMFPACK_DEPENDS DEAL_II_WITH_LAPACK)
 
 
-MACRO(FEATURE_UMFPACK_FIND_EXTERNAL var)
-  FIND_PACKAGE(UMFPACK)
-
-  IF(UMFPACK_FOUND)
-    SET(${var} TRUE)
-  ENDIF()
-ENDMACRO()
-
-
 MACRO(FEATURE_UMFPACK_CONFIGURE_EXTERNAL var)
 
   INCLUDE_DIRECTORIES(${UMFPACK_INCLUDE_DIRS})
@@ -60,9 +51,6 @@ MACRO(FEATURE_UMFPACK_CONFIGURE_BUNDLED var)
 ENDMACRO()
 
 
-SET(FEATURE_UMFPACK_CUSTOM_ERROR_MESSAGE TRUE)
-
-
 MACRO(FEATURE_UMFPACK_ERROR_MESSAGE)
   MESSAGE(FATAL_ERROR "\n"
     "Could not find the umfpack and amd libraries!\n"
index 858d81f9ca4dea62fc36311d0678629209c81be2..fc835e8e3379ca24764c629c0605b057d25863a1 100644 (file)
 #
 
 
-MACRO(FEATURE_ZLIB_FIND_EXTERNAL var)
-  FIND_PACKAGE(ZLIB)
-
-  IF(ZLIB_FOUND)
-    SET(${var} TRUE)
-  ENDIF()
-ENDMACRO()
-
-
 MACRO(FEATURE_ZLIB_CONFIGURE_EXTERNAL var)
   INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
   LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${ZLIB_LIBRARIES})
@@ -36,4 +27,3 @@ ENDMACRO()
 
 
 CONFIGURE_FEATURE(ZLIB)
-
index 67804f6d4b43e2fe45cdc60f791f9c9f9a4df4c2..a8edf6b156397e54246ff96ad8959be93b88017d 100644 (file)
@@ -19,9 +19,7 @@
 #     CONFIGURE_FEATURE(feature)
 #
 #
-# For a feature ${feature} (written in all caps) the following options,
-# variables and macros have to be defined (except marked as optional):
-#
+# This macro uses the following variables and macros:
 #
 # FEATURE_${feature}_DEPENDS (variable, optional)
 #    a variable which contains an optional list of other features
 #    bundled source dependencies. var set to TRUE indicates success,
 #    otherwise this script should issue a FATAL_ERROR.
 #
-# FEATURE_${feature}_FIND_EXTERNAL(var)  (macro, mandatory)
+# FEATURE_${feature}_FIND_EXTERNAL(var)  (macro, optional)
 #    which should set var to TRUE if all dependencies for the feature are
 #    fullfilled. In this case all necessary variables for
 #    FEATURE_${feature}_CONFIGURE_EXTERNAL must be set. Otherwise
 #    var should remain unset.
-#    This macro should give an error (FATAL_ERROR).
+#    If not defined, FIND_PACKAGE(${feature}) is called.
 #
 # FEATURE_${feature}_CONFIGURE_EXTERNAL(var)  (macro, mandatory)
 #    which should setup all necessary configuration for the feature with
 #    external dependencies. var set to TRUE indicates success,
 #    otherwise this script gives an error.
 #
-# FEATURE_${feature}_CUSTOM_ERROR_MESSAGE() (variable, optional)
-#    which should either be set to TRUE if FEATURE_${feature}_ERROR_MESSAGE
-#    is set up, or be undefined.
-#
 # FEATURE_${feature}_ERROR_MESSAGE()  (macro, optional)
 #    which should print a meaningfull error message (with FATAL_ERROR) for
 #    the case that no external library was found (and bundled is not
 #
 
 
-#
-# Some helper macros:
-#
+###########################################################################
+#                                                                         #
+#                             Helper Macros:                              #
+#                                                                         #
+###########################################################################
 
 #
 # Some black magic to have substitution in command names:
@@ -117,6 +113,23 @@ MACRO(FEATURE_ERROR_MESSAGE _feature)
 ENDMACRO()
 
 
+#
+# Default macro for finding an external library:
+#
+MACRO(FEATURE_FIND_EXTERNAL _feature _var)
+  FIND_PACKAGE(${_feature})
+  IF(${_feature}_FOUND)
+    SET(${_var} TRUE)
+  ENDIF()
+ENDMACRO()
+
+
+###########################################################################
+#                                                                         #
+#                           CONFIGURE_FEATURE:                            #
+#                                                                         #
+###########################################################################
+
 MACRO(CONFIGURE_FEATURE _feature)
   #
   # This script is arcane black magic. But at least for the better good: We
@@ -185,15 +198,10 @@ MACRO(CONFIGURE_FEATURE _feature)
         #
         # First case: DEAL_II_FORCE_BUNDLED_${_feature} is defined:
         #
-
         IF(FEATURE_${_feature}_HAVE_BUNDLED)
-          RUN_COMMAND(
-            "FEATURE_${_feature}_CONFIGURE_BUNDLED(FEATURE_${_feature}_BUNDLED_CONFIGURED)"
-            )
+          RUN_COMMAND("FEATURE_${_feature}_CONFIGURE_BUNDLED(FEATURE_${_feature}_BUNDLED_CONFIGURED)")
           IF(FEATURE_${_feature}_BUNDLED_CONFIGURED)
-            MESSAGE(STATUS
-              "DEAL_II_WITH_${_feature} successfully set up with bundled packages."
-              )
+            MESSAGE(STATUS "DEAL_II_WITH_${_feature} successfully set up with bundled packages.")
             SET_CACHED_OPTION(${_feature} ON)
           ELSE()
             # This should not happen. So give an error
@@ -213,23 +221,18 @@ MACRO(CONFIGURE_FEATURE _feature)
         #
         # Second case: We are allowed to search for an external library
         #
-
-        RUN_COMMAND(
-          "FEATURE_${_feature}_FIND_EXTERNAL(FEATURE_${_feature}_EXTERNAL_FOUND)"
-          )
+        IF(COMMAND FEATURE_${_feature}_FIND_EXTERNAL)
+          RUN_COMMAND("FEATURE_${_feature}_FIND_EXTERNAL(FEATURE_${_feature}_EXTERNAL_FOUND)")
+        ELSE()
+          FEATURE_FIND_EXTERNAL(${_feature} FEATURE_${_feature}_EXTERNAL_FOUND)
+        ENDIF()
 
         IF(FEATURE_${_feature}_EXTERNAL_FOUND)
-          MESSAGE(STATUS
-            "All external dependencies for DEAL_II_WITH_${_feature} are fullfilled."
-            )
-          RUN_COMMAND(
-            "FEATURE_${_feature}_CONFIGURE_EXTERNAL(FEATURE_${_feature}_EXTERNAL_CONFIGURED)"
-            )
+          MESSAGE(STATUS "All external dependencies for DEAL_II_WITH_${_feature} are fullfilled.")
+          RUN_COMMAND("FEATURE_${_feature}_CONFIGURE_EXTERNAL(FEATURE_${_feature}_EXTERNAL_CONFIGURED)")
 
           IF(FEATURE_${_feature}_EXTERNAL_CONFIGURED)
-            MESSAGE(STATUS
-              "DEAL_II_WITH_${_feature} successfully set up with external dependencies."
-              )
+            MESSAGE(STATUS "DEAL_II_WITH_${_feature} successfully set up with external dependencies.")
             SET_CACHED_OPTION(${_feature} ON)
           ELSE()
             # This should not happen. So give an error
@@ -241,18 +244,12 @@ MACRO(CONFIGURE_FEATURE _feature)
 
         ELSE(FEATURE_${_feature}_EXTERNAL_FOUND)
 
-          MESSAGE(STATUS
-            "DEAL_II_WITH_${_feature} has unmet external dependencies."
-            )
+          MESSAGE(STATUS "DEAL_II_WITH_${_feature} has unmet external dependencies.")
 
           IF(FEATURE_${_feature}_HAVE_BUNDLED AND DEAL_II_ALLOW_BUNDLED)
-            RUN_COMMAND(
-              "FEATURE_${_feature}_CONFIGURE_BUNDLED(FEATURE_${_feature}_BUNDLED_CONFIGURED)"
-              )
+            RUN_COMMAND("FEATURE_${_feature}_CONFIGURE_BUNDLED(FEATURE_${_feature}_BUNDLED_CONFIGURED)")
             IF(FEATURE_${_feature}_BUNDLED_CONFIGURED)
-              MESSAGE(STATUS
-                "DEAL_II_WITH_${_feature} successfully set up with bundled packages."
-                )
+              MESSAGE(STATUS "DEAL_II_WITH_${_feature} successfully set up with bundled packages.")
               SET_CACHED_OPTION(${_feature} ON)
             ELSE()
               # This should not happen. So give an error
@@ -263,7 +260,7 @@ MACRO(CONFIGURE_FEATURE _feature)
             ENDIF()
           ELSE()
             IF(DEAL_II_WITH_${_feature})
-              IF(FEATURE_${_feature}_CUSTOM_ERROR_MESSAGE)
+              IF(COMMAND FEATURE_${_feature}_ERROR_MESSAGE)
                 RUN_COMMAND("FEATURE_${_feature}_ERROR_MESSAGE()")
               ELSE()
                 FEATURE_ERROR_MESSAGE(${_feature})
index b41d4c36dd68742e3b7ebe1e960bad6c54fb5c6b..3e3c88b30d4b93142244963c2edd739fa2800ba9 100644 (file)
         to work.) The features must be given with the full option toggle
         DEAL_II_WITH_[...]
 
-    FEATURE_&lt;FEATURE&gt;_FIND_EXTERNAL(var)  (macro, mandatory)
+    FEATURE_&lt;FEATURE&gt;_FIND_EXTERNAL(var)  (macro, optional)
       - which should set var to TRUE if all dependencies for the feature are
         fulfilled. In this case all necessary variables for
         FEATURE_&lt;FEATURE&gt;_CONFIGURE_EXTERNAL must be set. Otherwise
         var should remain unset.
-        This macro must not give an error (SEND_ERROR or FATAL_ERROR).
+        If not defined, FIND_PACKAGE(${feature}) is called.
 
     FEATURE_&lt;FEATURE&gt;_CONFIGURE_EXTERNAL(var)  (macro, mandatory)
       - which should setup all necessary configuration for the feature with
 
     FEATURE_&lt;FEATURE&gt;_CONFIGURE_BUNDLED(var)  (macro, optional)
       - which should setup all necessary configuration for the feature with
-        bundled source dependencies. var set to TRUE indicates success.
-
-    FEATURE_&lt;FEATURE&gt;_CUSTOM_ERROR_MESSAGE() (variable, optional)
-      - which should either be set to TRUE if FEATURE_&lt;FEATURE&gt;_ERROR_MESSAGE
-        is set up, or be undefined.
+        bundled source dependencies. var set to TRUE indicates success,
+        otherwise this script should issue a FATAL_ERROR.
 
     FEATURE_&lt;FEATURE&gt;_ERROR_MESSAGE()  (macro, optional)
       - which should print a meaningful error message (with FATAL_ERROR) for
         the case that no external library was found (and bundled is not
         allowed to be used.) If not defined, a suitable default error message
         will be printed.
+
          </pre>
 
        <li>

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.