Commit b1e924e6 authored by Martin Nolte's avatar Martin Nolte

Merge branch 'feature/FS1713-add-config_h-bottom-section' into 'master'

[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
parents 31252385 c35b018a
......@@ -754,7 +754,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()
......@@ -762,6 +773,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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment