Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 rock-master-19.06-ruby-orogen (1.1-1) UNRELEASED; urgency=medium
 .
   * Initial release (Closes: #nnnn)
Author: MAINTAINER <rock-user@rock.dfki.uni-bremen.de>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2020-01-27

--- rock-master-19.06-ruby-orogen-1.1.orig/lib/orogen/gen/base.rb
+++ rock-master-19.06-ruby-orogen-1.1/lib/orogen/gen/base.rb
@@ -80,17 +80,21 @@ module OroGen
         end
 
         def self.cmake_pkgconfig_require(depspec, context = 'core')
-            depspec.inject([]) do |result, s|
+            cmake_txt = "set(DEPS_CFLAGS_OTHER \"\")\n"
+            cmake_txt += depspec.inject([]) do |result, s|
                 result << "orogen_pkg_check_modules(#{s.var_name} REQUIRED #{s.pkg_name})"
                 if s.in_context?(context, 'include')
                     result << "include_directories(${#{s.var_name}_INCLUDE_DIRS})"
-                    result << "add_definitions(${#{s.var_name}_CFLAGS_OTHER})"
+                    result << "list(APPEND DEPS_CFLAGS_OTHER ${#{s.var_name}_CFLAGS_OTHER})"
                 end
                 if s.in_context?(context, 'link')
                     result << "link_directories(${#{s.var_name}_LIBRARY_DIRS})"
                 end
                 result
             end.join("\n") + "\n"
+            cmake_txt += "list(REMOVE_DUPLICATES DEPS_CFLAGS_OTHER)\n"
+            cmake_txt += "add_definitions(${DEPS_CFLAGS_OTHER})\n"
+            cmake_txt
         end
 
         def self.cmake_pkgconfig_link(context, target, depspec)
