From a40bdadf8bf5987e97666d8341ba48d139a6ecd6 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Sat, 5 Mar 2016 02:33:48 -0600 Subject: [PATCH] CMake: Use DEAL_II_COMPONENTS in setup_write_config.cmake ... and get rid of a variable introspection. --- cmake/setup_cached_variables.cmake | 15 ++++++++++----- cmake/setup_write_config.cmake | 21 ++++++--------------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/cmake/setup_cached_variables.cmake b/cmake/setup_cached_variables.cmake index 95b336a002..966a2a223a 100644 --- a/cmake/setup_cached_variables.cmake +++ b/cmake/setup_cached_variables.cmake @@ -76,17 +76,27 @@ If(DEAL_II_HAVE_DOC_DIRECTORY) "Enable configuration, build and installation of the documentation. This adds a COMPONENT \"documentation\" to the build system." OFF ) + LIST(APPEND DEAL_II_COMPONENTS DOCUMENTATION) + ENDIF() OPTION(DEAL_II_COMPONENT_EXAMPLES "Enable configuration and installation of the example steps. This adds a COMPONENT \"examples\" to the build system." ON ) +LIST(APPEND DEAL_II_COMPONENTS EXAMPLES) + +OPTION(DEAL_II_COMPONENT_PACKAGE + "Generates additional targets for packaging deal.II" + OFF + ) +LIST(APPEND DEAL_II_COMPONENTS PACKAGE) OPTION(DEAL_II_COMPONENT_PARAMETER_GUI "Build and install the parameter_gui. This adds a COMPONENT \"parameter_gui\" to the build system." OFF ) +LIST(APPEND DEAL_II_COMPONENTS PARAMETER_GUI) OPTION(DEAL_II_ALLOW_AUTODETECTION "Allow to automatically set up features by setting all undefined DEAL_II_WITH_* variables to ON or OFF" @@ -98,11 +108,6 @@ OPTION(DEAL_II_FORCE_AUTODETECTION OFF ) -OPTION(DEAL_II_COMPONENT_PACKAGE - "Generates additional targets for packaging deal.II" - OFF - ) - ######################################################################## # # diff --git a/cmake/setup_write_config.cmake b/cmake/setup_write_config.cmake index 638f81eab3..c87aa076c2 100644 --- a/cmake/setup_write_config.cmake +++ b/cmake/setup_write_config.cmake @@ -230,21 +230,12 @@ _both( "#\n# Component configuration:\n" ) -GET_CMAKE_PROPERTY(_variables VARIABLES) -FOREACH(_var ${_variables}) - IF(_var MATCHES "DEAL_II_COMPONENT") - LIST(APPEND _components "${_var}") - ENDIF() -ENDFOREACH() -FOREACH(_var ${_components}) - IF(_var MATCHES "DEAL_II_COMPONENT") - IF(${${_var}}) - _both("# ${_var}\n") - STRING(REPLACE "DEAL_II_COMPONENT_" "" _component ${_var}) - LIST(APPEND _components ${_component}) - ELSE() - _both("# ( ${_var} = ${${_var}} )\n") - ENDIF() +FOREACH(_component ${DEAL_II_COMPONENTS}) + SET(_var DEAL_II_COMPONENT_${_component}) + IF(${${_var}}) + _both("# ${_var}\n") + ELSE() + _both("# ( ${_var} = ${${_var}} )\n") ENDIF() ENDFOREACH() -- 2.39.5