From: Matthias Maier Date: Sat, 26 Nov 2022 16:41:07 +0000 (-0600) Subject: CMake: export _SPLIT_CONFIGURATION X-Git-Tag: v9.5.0-rc1~797^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8daf768abda349e3d897c3e5d82478d16d8d2f30;p=dealii.git CMake: export _SPLIT_CONFIGURATION --- diff --git a/cmake/macros/macro_clear_feature.cmake b/cmake/macros/macro_clear_feature.cmake index b0999da355..7e8b4b3757 100644 --- a/cmake/macros/macro_clear_feature.cmake +++ b/cmake/macros/macro_clear_feature.cmake @@ -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() diff --git a/cmake/macros/macro_process_feature.cmake b/cmake/macros/macro_process_feature.cmake index 3f2d9eb018..b298037c1d 100644 --- a/cmake/macros/macro_process_feature.cmake +++ b/cmake/macros/macro_process_feature.cmake @@ -19,9 +19,10 @@ # [CLEAR ] # ) # -# 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: # @@ -36,22 +37,35 @@ # ) # # 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 _ variables will be cleared +# +# In addition the macro defines the booleans +# +# _FOUND - true if processing was successful +# _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() diff --git a/cmake/setup_write_config.cmake b/cmake/setup_write_config.cmake index a975b82cf4..0eea423ec0 100644 --- a/cmake/setup_write_config.cmake +++ b/cmake/setup_write_config.cmake @@ -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: #