Skip to content
Snippets Groups Projects
Commit c35b018a authored by Tobias Malkmus's avatar Tobias Malkmus
Browse files

[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 is extracted and placed
at the end of the collected config.h file.

This resolves the problems from FS#1713.
parent 4420871a
No related branches found
No related tags found
1 merge request!19[cmake] extract bottom block from config.h.cmake
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment