From 1605dbb06cfa29e1094e8abe9121541ec8a6257f Mon Sep 17 00:00:00 2001 From: Martin Nolte <nolte@mathematik.uni-freiburg.de> Date: Thu, 18 Feb 2016 10:18:57 +0000 Subject: [PATCH] Merge branch 'feature/FS1713-add-config_h-bottom-section' into 'master' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [cmake] extract bottom block from config.h.cmake For dune-grid a bottom section is needed to place the Grid Type magic at the bottom of the config.h file in derived modules. In this patch a /* begin bottom */ ... /* end bottom */ block from each module's config.h.cmake file and placed at the end of the collected config.h file. This resolves the problems from FS#1713 if the same branch is applied in dune-grid. See merge request !19 (cherry picked from commit b1e924e608c65c97426b785ba006c115ac6c6a97) Signed-off-by: Steffen Müthing <muething@dune-project.org> --- cmake/modules/DuneMacros.cmake | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cmake/modules/DuneMacros.cmake b/cmake/modules/DuneMacros.cmake index fca9fc8ae..09f55b0dd 100644 --- a/cmake/modules/DuneMacros.cmake +++ b/cmake/modules/DuneMacros.cmake @@ -724,7 +724,18 @@ macro(dune_regenerate_config_cmake) ".*/\\*[ ]*begin[ ]+${_dep}[^\\*]*\\*/(.*)/[/\\*][ ]*end[ ]*${_dep}[^\\*]*\\*/" "\\1" _tfile "${_file}") # strip the private section - string(REGEX REPLACE "(.*)/[\\*][ ]*begin private.*/[\\*][ ]*end[ ]*private[^\\*]\\*/(.*)" "\\1\\2" _file "${_tfile}") + string(REGEX REPLACE "(.*)/[\\*][ ]*begin private.*/[\\*][ ]*end[ ]*private[^\\*]\\*/(.*)" "\\1\\2" _ttfile "${_tfile}") + + # extract the bottom section + string(REGEX MATCH "/[\\*][ ]*begin bottom.*/[\\*][ ]*end[ ]*bottom[^\\*]\\*/" _tbottom "${_ttfile}") + string(REGEX REPLACE ".*/\\*[ ]*begin[ ]+bottom[^\\*]*\\*/(.*)/[/\\*][ ]*end[ ]*bottom[^\\*]*\\*/" "\\1" ${_dep}_CONFIG_H_BOTTOM "${_tbottom}" ) + string(REGEX REPLACE "(.*)/[\\*][ ]*begin bottom.*/[\\*][ ]*end[ ]*bottom[^\\*]\\*/(.*)" "\\1\\2" _file "${_ttfile}") + + # append bottom section + if(${_dep}_CONFIG_H_BOTTOM) + set(CONFIG_H_BOTTOM "${CONFIG_H_BOTTOM} ${${_dep}_CONFIG_H_BOTTOM}") + endif() + file(APPEND ${CONFIG_H_CMAKE_FILE} "${_file}") endif(EXISTS ${_mod_conf_file}) endforeach() @@ -732,6 +743,10 @@ macro(dune_regenerate_config_cmake) # parse again dune.module file of current module to set PACKAGE_* variables dune_module_information(${CMAKE_SOURCE_DIR} QUIET) file(APPEND ${CONFIG_H_CMAKE_FILE} "\n${_myfile}") + # append CONFIG_H_BOTTOM section at the end if found + if(CONFIG_H_BOTTOM) + file(APPEND ${CONFIG_H_CMAKE_FILE} "${CONFIG_H_BOTTOM}") + endif() endmacro(dune_regenerate_config_cmake) # macro that should be called at the end of the top level CMakeLists.txt. -- GitLab