]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
DEAL_II_FEATURE_AUTODETECTION
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 14 Sep 2012 14:32:25 +0000 (14:32 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 14 Sep 2012 14:32:25 +0000 (14:32 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_cmake@26384 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/CMakeLists.txt
deal.II/contrib/cmake/macros/macro_configure_feature.cmake

index 28fef9b25b654d6ce7191d6b4c4f7c9c0671db1e..bb4a4b6afe1ec8d8f55fd13729d7f411e768a1eb 100644 (file)
@@ -84,7 +84,7 @@ OPTION(DEAL_II_FEATURE_AUTODETECTION
   "Enables feature autodetection. This will automatically overwrite all
   DEAL_II_WITH_<...> toggles depending on whether they can be supported or
   not."
-  OFF)
+  ON)
 
 OPTION(DEAL_II_WITH_BLAS
   "Build deal.II with support for BLAS."
index 421c8f59bb578c3ae495ad1ed005731ff88110a6..0790c60036ce1f889dacec2970e86cf16ece3cf6 100644 (file)
@@ -47,7 +47,9 @@
 #
 
 
+#
 # Some black magic to have substitution in command names:
+#
 MACRO(RUN_COMMAND the_command)
   FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/macro_configure_feature.tmp"
     "${the_command}")
@@ -55,100 +57,130 @@ MACRO(RUN_COMMAND the_command)
 ENDMACRO()
 
 
-MACRO(CONFIGURE_FEATURE feature)
+#
+# A small macro to set the DEAL_II_WITH_${feature} variables:
+#
+MACRO(SET_CACHED_OPTION feature value)
+  SET(DEAL_II_WITH_${feature}
+    ${value}
+    CACHE STRING
+    "Automatically set due to DEAL_II_FEATURE_AUTODETECTION"
+    FORCE)
+ENDMACRO()
 
-  #
-  # First case: DEAL_II_FORCE_CONTRIB_${feature} is defined:
-  #
-  IF(DEAL_II_FORCE_CONTRIB_${feature})
 
-    IF(HAVE_CONTRIB_FEATURE_${feature})
-      RUN_COMMAND(
-        "
-        CONFIGURE_FEATURE_${feature}_CONTRIB(
-          FEATURE_${feature}_CONTRIB_CONFIGURED
-          )
-        "
-        )
-      IF(FEATURE_${feature}_CONTRIB_CONFIGURED)
-        MESSAGE(STATUS
-          "DEAL_II_WITH_${feature} successfully set up with contrib packages."
-          )
-      ELSE()
-        MESSAGE(SEND_ERROR
-          "Failed to set up DEAL_II_WITH_${feature} with contrib packages."
-          )
-      ENDIF()
-    ELSE()
-      MESSAGE(FATAL_ERROR
-        "Internal build system error: DEAL_II_FORCE_CONTRIB_${feature} defined, but HAVE_CONTRIB_FEATURE_${feature} not present."
-        )
-    ENDIF()
+MACRO(CONFIGURE_FEATURE feature)
 
-  ELSE()
+  # Only (try) to configure ${feature} if we have to:
+  IF(DEAL_II_FEATURE_AUTODETECTION OR DEAL_II_WITH_${feature})
 
     #
-    # Second case: We may search for an external library:
+    # First case: DEAL_II_FORCE_CONTRIB_${feature} is defined:
     #
-    RUN_COMMAND(
-      "FIND_FEATURE_${feature}_EXTERNAL(FEATURE_${feature}_EXTERNAL_FOUND)"
-      )
-
-    IF(FEATURE_${feature}_EXTERNAL_FOUND)
-
-      MESSAGE(STATUS
-        "All external dependencies for DEAL_II_WITH_${feature} are fullfilled."
-        )
+    IF(DEAL_II_FORCE_CONTRIB_${feature})
 
-      RUN_COMMAND(
-        "
-        CONFIGURE_FEATURE_${feature}_EXTERNAL(
-          FEATURE_${feature}_EXTERNAL_CONFIGURED
-          )
-        "
-        )
-
-      IF(FEATURE_${feature}_EXTERNAL_CONFIGURED)
-        MESSAGE(STATUS
-          "DEAL_II_WITH_${feature} successfully set up with external dependencies."
+      IF(HAVE_CONTRIB_FEATURE_${feature})
+        RUN_COMMAND(
+          "
+          CONFIGURE_FEATURE_${feature}_CONTRIB(
+            FEATURE_${feature}_CONTRIB_CONFIGURED
+            )
+          "
           )
+        IF(FEATURE_${feature}_CONTRIB_CONFIGURED)
+          MESSAGE(STATUS
+            "DEAL_II_WITH_${feature} successfully set up with contrib packages."
+            )
+          IF(DEAL_II_FEATURE_AUTODETECTION)
+            SET_CACHED_OPTION(DEAL_II_WITH_${feature} on)
+          ENDIF()
+        ELSE()
+          # This should not happen. So give an error
+          MESSAGE(SEND_ERROR
+            "Failed to set up DEAL_II_WITH_${feature} with contrib packages."
+            )
+        ENDIF()
       ELSE()
-        MESSAGE(SEND_ERROR
-          "Failed to set up DEAL_II_WITH_${feature} with external dependencies."
+        MESSAGE(FATAL_ERROR
+          "Internal build system error: DEAL_II_FORCE_CONTRIB_${feature} defined, but HAVE_CONTRIB_FEATURE_${feature} not present."
           )
       ENDIF()
 
     ELSE()
 
-      MESSAGE(STATUS
-        "DEAL_II_WITH_${feature} has unmet external dependencies."
+      #
+      # Second case: We are allowed to search for an external library:
+      #
+      RUN_COMMAND(
+        "FIND_FEATURE_${feature}_EXTERNAL(FEATURE_${feature}_EXTERNAL_FOUND)"
         )
 
-      IF(HAVE_CONTRIB_FEATURE_${feature} AND DEAL_II_ALLOW_CONTRIB)
+      IF(FEATURE_${feature}_EXTERNAL_FOUND)
+
+        MESSAGE(STATUS
+          "All external dependencies for DEAL_II_WITH_${feature} are fullfilled."
+          )
+
         RUN_COMMAND(
           "
-          CONFIGURE_FEATURE_${feature}_CONTRIB(
-            FEATURE_${feature}_CONTRIB_CONFIGURED
+          CONFIGURE_FEATURE_${feature}_EXTERNAL(
+            FEATURE_${feature}_EXTERNAL_CONFIGURED
             )
           "
           )
-        IF(FEATURE_${feature}_CONTRIB_CONFIGURED)
+
+        IF(FEATURE_${feature}_EXTERNAL_CONFIGURED)
           MESSAGE(STATUS
-            "DEAL_II_WITH_${feature} successfully set up with contrib packages."
+            "DEAL_II_WITH_${feature} successfully set up with external dependencies."
             )
+          IF(DEAL_II_FEATURE_AUTODETECTION)
+            SET_CACHED_OPTION(DEAL_II_WITH_${feature} on)
+          ENDIF()
         ELSE()
-          # TODO: Opt out!
+          # This should not happen. So give an error
           MESSAGE(SEND_ERROR
-            "Failed to set up DEAL_II_WITH_${feature} with contrib packages."
+            "Failed to set up DEAL_II_WITH_${feature} with external dependencies."
             )
         ENDIF()
+
       ELSE()
-        # TODO: Opt out!
-        RUN_COMMAND(
-          "CONFIGURE_FEATURE_${feature}_ERROR_MESSAGE()"
+
+        MESSAGE(STATUS
+          "DEAL_II_WITH_${feature} has unmet external dependencies."
           )
-      ENDIF()
 
+        IF(HAVE_CONTRIB_FEATURE_${feature} AND DEAL_II_ALLOW_CONTRIB)
+          RUN_COMMAND(
+            "
+            CONFIGURE_FEATURE_${feature}_CONTRIB(
+              FEATURE_${feature}_CONTRIB_CONFIGURED
+              )
+            "
+            )
+          IF(FEATURE_${feature}_CONTRIB_CONFIGURED)
+            MESSAGE(STATUS
+              "DEAL_II_WITH_${feature} successfully set up with contrib packages."
+              )
+            IF(DEAL_II_FEATURE_AUTODETECTION)
+              SET_CACHED_OPTION(DEAL_II_WITH_${feature} on)
+            ENDIF()
+          ELSE()
+            # This should not happen. So give an error
+            MESSAGE(SEND_ERROR
+              "Failed to set up DEAL_II_WITH_${feature} with contrib packages."
+              )
+          ENDIF()
+        ELSE()
+            IF(DEAL_II_FEATURE_AUTODETECTION)
+              SET_CACHED_OPTION(DEAL_II_WITH_${feature} on)
+            ELSE()
+              RUN_COMMAND(
+                "CONFIGURE_FEATURE_${feature}_ERROR_MESSAGE()"
+                )
+            ENDIF()
+        ENDIF()
+
+      ENDIF()
     ENDIF()
 
   ENDIF()

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.