#
+#
# 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}")
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()