From 0f1a82c30205e12ffbd84500d113220f4a6e8282 Mon Sep 17 00:00:00 2001
From: Florian Uhlig <f.uhlig@gsi.de>
Date: Wed, 5 Oct 2022 10:11:42 +0200
Subject: [PATCH] Fix installation

The header files from subdirectories were expected by ROOT in the wrong
directory structure. Pass the header files without the path  when generating
the dictionary.
---
 cmake/modules/CbmMacros.cmake | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/cmake/modules/CbmMacros.cmake b/cmake/modules/CbmMacros.cmake
index fc8784566b..b825390238 100644
--- a/cmake/modules/CbmMacros.cmake
+++ b/cmake/modules/CbmMacros.cmake
@@ -201,6 +201,12 @@ macro(generate_cbm_library)
       endif()
   endforeach()
 
+  foreach (HEADER ${HEADERS})
+    # strip relative path from headers to pass them to rootcling
+    get_filename_component(_rootheader ${HEADER} NAME)
+    list(APPEND ROOT_HEADERS ${_rootheader})
+  endforeach()
+
   ######################### build the library ############################
   add_library(${LIBRARY_NAME} SHARED ${HEADERS} ${SRCS} ${NO_DICT_SRCS} ${LINKDEF})
   
@@ -208,7 +214,7 @@ macro(generate_cbm_library)
   target_include_directories(${LIBRARY_NAME} PUBLIC ${INCLUDE_DIRECTORIES})
 
   if(LINKDEF)
-    root_generate_dictionary(G__${LIBRARY_NAME} ${HEADERS} MODULE ${LIBRARY_NAME} LINKDEF ${LINKDEF})
+    root_generate_dictionary(G__${LIBRARY_NAME} ${ROOT_HEADERS} MODULE ${LIBRARY_NAME} LINKDEF ${LINKDEF})
   endif(LINKDEF)
 
   ############# Install target and corresponding header files ############
-- 
GitLab