Problem 1213

Summary: FindGEANT4.cmake in source
Product: Geant4 Reporter: Yngve Inntjore Levinsen <yngve.inntjore.levinsen>
Component: cmakeAssignee: Ben Morgan <Ben.Morgan>
Status: CLOSED WONTFIX    
Severity: enhancement CC: yngve.inntjore.levinsen
Priority: P5    
Version: 9.4   
Hardware: All   
OS: All   

Description Yngve Inntjore Levinsen 2011-05-15 22:14:05 CEST
As a part of the support for CMake it would be nice if a FindGEANT4.cmake script was added to the sources for other projects to use when linking to Geant4. I found one here while searching the web:
http://aliceinfo.cern.ch/static/aliroot-pro/cmake/modules/

This seems to be a nice start but it needs expanding.
Comment 1 Ben Morgan 2011-05-16 11:04:29 CEST
We'll look at adding this - I do have a FindGeant4.cmake module that improves on the example posted, but like that one it also needs work ;-).

See also Bug #1200 - this is not strictly a duplicate (and I won't mark it as so), but is connected because the preferred solution for application builders using CMake will be to provide Geant4{Config,ConfigVersion}.cmake files. However, the module based find will be useful for CMake users wishing to find older versions, so we'll look into it.

Cheers,

Ben.
Comment 2 Yngve Inntjore Levinsen 2011-05-16 13:48:36 CEST
Aha, I was not aware of the concept of FooBarConfig.cmake files, perhaps that is a better/sufficient solution. I am no CMake expert so it seems you know more than me in this field. And yes, I also did some preliminary modifications to the script posted (adding search paths), but it is not sufficient I believe.
Comment 3 Ben Morgan 2011-07-05 11:17:56 CEST
Marking this as a WONTFIX because as of the 9.5 beta, we supply a Geant4Config.cmake module, plus support modules, which can be used by the 'config mode' of CMake's find_package command.

A project using Geant4 simply has to write

find_package(Geant4 <ARGS>)

in their CMakeLists.txt, and when running CMake point it to 'Geant4_DIR', the location of the Geant4Config.cmake module, e.g.

cmake -DGeant4_DIR=/usr/lib/Geant4-9.5.0 <path-to-source>