From 1490cd7389fc149c5bf3fe2558e2272caf271aba Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Mon, 5 Aug 2013 20:46:38 +0200 Subject: [PATCH] Provide hook to configure getting other's version This hook together with the bundled convenience macro makes it possible to add the version of another module to config.h using code like this: macro (config_hook) opm_need_version_of ("dune-common") endmacro (config_hook) --- cmake/Modules/OpmLibMain.cmake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cmake/Modules/OpmLibMain.cmake b/cmake/Modules/OpmLibMain.cmake index ca68ccb2..74781c47 100644 --- a/cmake/Modules/OpmLibMain.cmake +++ b/cmake/Modules/OpmLibMain.cmake @@ -121,6 +121,20 @@ if (COMMAND sources_hook) sources_hook () endif (COMMAND sources_hook) +# convenience macro to add version of another suite, e.g. dune-common +macro (opm_need_version_of what) + string (TOUPPER "${what}" _WHAT) + string (REPLACE "-" "_" _WHAT "${_WHAT}") + list (APPEND ${project}_CONFIG_IMPL_VARS + ${_WHAT}_VERSION_MAJOR ${_WHAT}_VERSION_MINOR ${_WHAT}_VERSION_REVISION + ) +endmacro (opm_need_version_of suite module) + +# use this hook to add version macros before we write to config.h +if (COMMAND config_hook) + config_hook () +endif (COMMAND config_hook) + # create configuration header which describes available features # necessary to compile this library. singular version is the names that # is required by this project alone, plural version transitively