From 9a2ea931a452d61d63cb77193a11c23d377e21d4 Mon Sep 17 00:00:00 2001
From: Andre Sailer <andre.philippe.sailer@cern.ch>
Date: Wed, 17 Jul 2019 17:18:06 +0200
Subject: [PATCH] Dictionaries, set compile flags for generated files at
 generation point

---
 cmake/DD4hepBuild.cmake | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake
index 4a46c6034..4bfb0951c 100644
--- a/cmake/DD4hepBuild.cmake
+++ b/cmake/DD4hepBuild.cmake
@@ -1591,7 +1591,9 @@ function( new_dd4hep_add_dictionary dictionary )
 
   set_source_files_properties(${dictionary}.cxx ${output_dir}/${dictionary}_rdict.pcm
     PROPERTIES
-    GENERATED TRUE)
+    GENERATED TRUE
+    COMPILE_FLAGS "-Wno-unused-function -Wno-overlength-strings"
+    )
 
   #  Install the binary to the destination directory
   install(FILES ${output_dir}/${dictionary}_rdict.pcm DESTINATION lib)
@@ -1622,11 +1624,6 @@ function(new_dd4hep_add_plugin binary)
     set(NOINSTALL NOINSTALL)
   endif()
   file(GLOB SOURCES ${ARG_SOURCES})
-  foreach( f in  ${ARG_GENERATED})
-    set_source_files_properties(${f} PROPERTIES
-      COMPILE_FLAGS "-Wno-unused-function -Wno-overlength-strings"
-      GENERATED TRUE)
-  endforeach()
 
   ADD_LIBRARY(${binary} SHARED ${SOURCES} ${ARG_GENERATED})
   TARGET_LINK_LIBRARIES(${binary} PUBLIC ${ARG_LINK_LIBRARIES})
-- 
GitLab