]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: export <FEATURE>_SPLIT_CONFIGURATION
authorMatthias Maier <tamiko@43-1.org>
Sat, 26 Nov 2022 16:41:07 +0000 (10:41 -0600)
committerMatthias Maier <tamiko@43-1.org>
Sat, 26 Nov 2022 23:48:07 +0000 (17:48 -0600)
cmake/macros/macro_clear_feature.cmake
cmake/macros/macro_process_feature.cmake
cmake/setup_write_config.cmake

index b0999da355754f90f259699c2cc0902c8dec97e0..7e8b4b3757df880ae9d1ae52b85e615d5c18faba 100644 (file)
@@ -28,4 +28,6 @@ macro(clear_feature _feature)
   foreach(_var ${DEAL_II_LIST_SUFFIXES} ${DEAL_II_STRING_SUFFIXES})
     unset(${_feature}_${_var})
   endforeach()
+  unset(${_FEATURE}_FOUND)
+  unset(${_FEATURE}_SPLIT_CONFIGURATION)
 endmacro()
index 3f2d9eb0184d65a7d64c0567db619cf2119b7972..b298037c1ded132835ab89687e961da92eddbcdd 100644 (file)
 #  [CLEAR <variables>]
 #  )
 #
-# This macro is an alternative implementation of the
-# FIND_PACKAGE_HANDLE_STANDARD_ARGS macro shipped with CMake - aka do
-# everything that was expected from CMake in the first place *sigh*
+# This macro processes a configuration statement similar to
+# FIND_PACKAGE_HANDLE_STANDARD_ARGS() macro shipped with CMake - but in
+# contrast to the CMake macro it populates corresponding FEATURE_*
+# variables.
 #
 # Its usage is best explained with an example:
 #
 #     )
 #
 # This will check whether all REQUIRED variables are non-empty and
-# different from "-NOTFOUND". If so, PETSC_LIBRARIES and PETSC_INCLUDE_DIRS
-# is defined and populated with the contents of all specified variables.
-# Optional variables with no content or whose content is "-NOTFOUND" are
-# filtered out.
+# different from "-NOTFOUND". If so, the PETSC_LIBRARIES and
+# PETSC_INCLUDE_DIRS will be defined and populated with the contents of all
+# specified variables. Optional variables with no content or whose content
+# is "-NOTFOUND" are filtered out.
+#
 # After the 'CLEAR' statement all internally cached variables should be
 # listed - this is used to provide a possibility to undo a feature
 # search.
 #
+# Valid suffixes are
+#   CXX_FLAGS    CXX_FLAGS_RELEASE    CXX_FLAGS_DEBUG
+#   DEFINITIONS  DEFINITIONS_RELEASE  DEFINITIONS_DEBUG
+#   EXECUTABLE
+#   INCLUDE_DIRS
+#   LIBRARIES    LIBRARIES_RELEASE    LIBRARIES_DEBUG
+#   LINKER_FLAGS LINKER_FLAGS_RELEASE LINKER_FLAGS_DEBUG
+#
+# Note: The contents of all <feature>_<suffix> variables will be cleared
+#
+# In addition the macro defines the booleans
+#
+#   <feature>_FOUND                -  true if processing was successful
+#   <feature>_SPLIT_CONFIGURATION  -  true if separate debug and release
+#                                     values have been defined.
+#
 
 macro(process_feature _feature)
 
-  message(STATUS "Configuring ${_feature} interface target:")
-
-  if(DEFINED ${_feature}_VERSION)
-    message(STATUS "  ${_feature}_VERSION: ${${_feature}_VERSION}")
-  endif()
+  message(STATUS "Processing ${_feature} variables and targets")
 
   #
   # Respect a possible ${_feature}_FOUND variable that is set to a truth
@@ -78,6 +92,11 @@ macro(process_feature _feature)
   set(_current_suffix "")
   set(_required TRUE)
 
+  #
+  # Record whether we have encountered split *_DEBUG/*_RELEASE variables
+  #
+  set(_split_configuration FALSE)
+
   #
   # A temporary list accumulating all variables that should be "cleared"
   # when the feature gets disabled.
@@ -93,6 +112,10 @@ macro(process_feature _feature)
       #
       set(_current_suffix "${_arg}")
 
+      if(_current_suffix MATCHES "_DEBUG" OR _current_suffix MATCHES "_RELEASE")
+        set(_split_configuration TRUE)
+      endif()
+
     elseif("${_arg}" STREQUAL "REQUIRED")
       set(_required TRUE)
 
@@ -156,6 +179,7 @@ macro(process_feature _feature)
     foreach(_suffix ${_DEAL_II_STRING_SUFFIXES})
       to_string(_temp_${_suffix} ${_temp_${_suffix}})
     endforeach()
+    set(${_feature}_SPLIT_CONFIGURATION ${_split_configuration})
 
     #
     # Remove certain system libraries from the link interface. This is
@@ -178,19 +202,16 @@ macro(process_feature _feature)
     foreach(_suffix ${DEAL_II_LIST_SUFFIXES} ${DEAL_II_STRING_SUFFIXES})
       if(NOT "${_temp_${_suffix}}" STREQUAL "")
         set(${_feature}_${_suffix} "${_temp_${_suffix}}")
-        message(STATUS "  ${_feature}_${_suffix}: ${${_feature}_${_suffix}}")
       endif()
     endforeach()
 
     mark_as_advanced(${_feature}_DIR ${_feature}_ARCH)
 
-    #
-    # Finally create interface target:
-    #
-    # define_feature_target(${_feature})
+    message(STATUS "Processing ${_feature} variables and targets - Done")
 
   else()
 
-    message(STATUS "Could NOT configure ${_feature}")
+    clear_feature(${_feature})
+    message(STATUS "Unable to process ${_feature}")
   endif()
 endmacro()
index a975b82cf4bcbddc3c00c561017a72e4c63d0652..0eea423ec0564816581a0f65a695ce7309c4573f 100644 (file)
@@ -229,6 +229,11 @@ foreach(_feature ${_deal_ii_features_sorted})
       _featurelog("set(DEAL_II_${_feature}_DIR \"${${_feature}_DIR}\")\n")
     endif()
 
+    if(NOT "${${_feature}_SPLIT_CONFIGURATION}" STREQUAL "")
+      _detailed("#            ${_feature}_SPLIT_CONFIGURATION = ${${_feature}_SPLIT_CONFIGURATION}\n")
+      _featurelog("set(DEAL_II_${_feature}_SPLIT_CONFIGURATION \"${${_feature}_SPLIT_CONFIGURATION}\")\n")
+    endif()
+
     #
     # Print the feature configuration:
     #

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.