From bd578fd8d93bb302c3b58775e855a63706205325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20M=C3=BCthing?= <muething@dune-project.org> Date: Wed, 20 May 2015 15:49:21 +0200 Subject: [PATCH] [Release][CMake][Bugfix] Fix definition setup in dune_enable_all_packages() We have to call add_definitions() in a loop because add_definitions() is kind of broken: even though it is supposed to be *the* function for adding compile definitions, it does not prepend "-D" (as opposed to target_compile_definitions(), which does). Well, whatever... --- cmake/modules/DuneEnableAllPackages.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/modules/DuneEnableAllPackages.cmake b/cmake/modules/DuneEnableAllPackages.cmake index 5b9ddf76a..bd4563295 100644 --- a/cmake/modules/DuneEnableAllPackages.cmake +++ b/cmake/modules/DuneEnableAllPackages.cmake @@ -145,7 +145,14 @@ function(dune_enable_all_packages) # add compile definitions to all targets in module get_property(all_defs GLOBAL PROPERTY ALL_PKG_DEFS) - add_definitions(${all_defs}) + # We have to do this in a loop because add_definitions() is kind of broken: even though it is supposed + # to be *the* function for adding compile definitions, it does not prepend "-D" (as opposed to + # target_compile_definitions(), which does). Well, whatever... + foreach(_definition ${all_defs}) + if(_definition) + add_definitions("-D${_definition}") + endif() + endforeach() # verbose output of compile definitions if(DUNE_ENABLE_ALL_PACKAGES_VERBOSE) message("Compile definitions for this project: ${all_defs}") -- GitLab