Skip to content

Improve Module-Geant4 Interface in CMake

Simon Spannagel requested to merge f/239 into master

This is an attempt of a solution for #239 by moving linking etc of Geant4 libraries to module libraries into a common interface macro. This works fine so far, but I have no brilliant idea yet how a neat "don't-build-anything-that-requires-Geant4" CMake option cmake -DDISABLE_GEANT4_MODULES=ON .. or similar could work.

Right now, all the G4 check and linking setup happens after the target has already been defined via ADD_LIBRARY() - which means there is no simple way of switching off its build.

On the other hand, when moving that macro call to before ALLPIX_DETECTOR_MODULE() or ALLPIX_UNIQUE_MODULE where the targets are defined, we don't have access to all the information yet.

CMake sometimes is just. Beautiful. 😄

@slachnit any clever idea?

Edited by Simon Spannagel

Merge request reports