From 112b066c6e4d76f06ed5901b57cff1349174f4b3 Mon Sep 17 00:00:00 2001
From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de>
Date: Wed, 25 Feb 2015 20:21:01 +0100
Subject: [PATCH] Introduce an optional VERBOSE argument on the
 dune_enable_all_packages macro

If set, at the end of each configure run the set of registered flags will
be printed.
---
 cmake/modules/DuneEnableAllPackages.cmake | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/cmake/modules/DuneEnableAllPackages.cmake b/cmake/modules/DuneEnableAllPackages.cmake
index bc588712d..971add6e3 100644
--- a/cmake/modules/DuneEnableAllPackages.cmake
+++ b/cmake/modules/DuneEnableAllPackages.cmake
@@ -10,11 +10,12 @@
 #
 # This module provides the following macros:
 #
-# dune_enable_all_packages()
+# dune_enable_all_packages([VERBOSE])
 #
 # Adds all flags and all libraries to all executables that are added in the directory
 # from where this macro is called and from all its subdirectories (recursively).
 # Typically, a user would add the call to this macro to his top level CMakeLists.txt
+# With the VERBOSE option being set, the list of flags is printed during configure.
 #
 # dune_register_package_flags(COMPILE_DEFINITIONS flags
 #                             INCLUDE_DIRS includes
@@ -31,21 +32,37 @@
 # Only use it, if you know what you are doing.
 
 macro(dune_enable_all_packages)
+  include(CMakeParseArguments)
+  cmake_parse_arguments(ENABLE_ALL_PACKAGES VERBOSE "" "" ${ARGN})
+
   get_property(all_incs GLOBAL PROPERTY ALL_PKG_INCS)
   include_directories(${all_incs})
+  if(ENABLE_ALL_PACKAGES_VERBOSE)
+    message("Include directories for this project: ${all_incs}")
+  endif(ENABLE_ALL_PACKAGES_VERBOSE)
+
   get_property(all_libs GLOBAL PROPERTY ALL_PKG_LIBS)
   link_libraries(${DUNE_LIBS} ${all_libs})
+  if(ENABLE_ALL_PACKAGES_VERBOSE)
+    message("Libraries for this project: ${all_libs}")
+  endif(ENABLE_ALL_PACKAGES_VERBOSE)
+
   get_property(all_defs GLOBAL PROPERTY ALL_PKG_DEFS)
   foreach(def ${all_defs})
     add_definitions("-D${def}")
   endforeach(def in ${all_defs})
+  if(ENABLE_ALL_PACKAGES_VERBOSE)
+    message("Compile definitions for this project: ${all_libs}")
+  endif(ENABLE_ALL_PACKAGES_VERBOSE)
 endmacro(dune_enable_all_packages)
 
 function(dune_register_package_flags)
   include(CMakeParseArguments)
   set(OPTIONS PREPEND)
-  set(SINGLEARGS COMPILE_DEINITIONSS INCLUDE_DIRS LIBRARIES)
-  cmake_parse_arguments(REGISTRY "${OPTIONS}" "${SINGLEARGS}" "" ${ARGN})
+  set(SINGLEARGS)
+  set(MULTIARGS COMPILE_DEFINITIONS INCLUDE_DIRS LIBRARIES)
+  cmake_parse_arguments(REGISTRY "${OPTIONS}" "${SINGLEARGS}" "${MULTIARGS}" ${ARGN})
+
   if(REG_PREPEND)
     get_property(GLOBAL PROPERTY ALL_PKG_INCS all_incs)
     get_property(GLOBAL PROPERTY ALL_PKG_LIBS all_libs)
-- 
GitLab