diff --git a/cmake/modules/DuneMacros.cmake b/cmake/modules/DuneMacros.cmake index fca9fc8ae7291a0984c0aadb73083a3deb0e8a99..09f55b0dd319d3446b1e2fb3e0d55644c9809987 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.