Problem 1198

Summary: CMake buildscripts require explicit listing of source files
Product: Geant4 Reporter: Ben Morgan <Ben.Morgan>
Component: cmakeAssignee: Ben Morgan <Ben.Morgan>
Status: CLOSED WONTFIX    
Severity: normal    
Priority: P3    
Version: 9.4   
Hardware: All   
OS: All   
Problem Depends on:    
Problem Blocks: 1199    

Description Ben Morgan 2011-04-21 15:48:54 CEST
Geant4's CMake scripts require explicit listing of source/header files in the sources.cmake files. This creates issues for developers as they must remember to edit this file whenever a file is added or removed. 
This should be improved to replicate the behaviour of the current GNU Make system which picks these changes up automatically.
Comment 1 Ben Morgan 2011-04-21 15:59:24 CEST
This can be fixed using CMake's file(GLOB ...) command. I note that this is not the recommended way to locate sources in CMake. 

Explicit listing is recommended because changes to CMake scripts (in this case sources.cmake) are picked up by the buildsystem because CMake encodes dependencies on these files into the Make/project files. The developer then only needs to work with the buildsystem of choice, and rebuilds will automatically rerun CMake.

In Geant4, it's recognised that whilst explicit listing is recommended, it can lead to inconsistent builds because developers can and do forget to edit the sources.cmake files. Usage of file(GLOB ...) will help to mitigate this problem, at the cost of needing to explicitly rerun CMake when sources and/or VCS updates are made (e.g. 'make rebuild_cache' with Makefiles).

This fix has no effect on end users of Geant4.
Comment 2 Ben Morgan 2011-10-11 13:05:11 CEST
This will be addressed following the 9.5 release, so postponed until 2012.

Just marking the bug as LATER, so it's known about, but the status is clear.
Comment 3 Ben Morgan 2018-05-08 14:34:00 CEST
Globbing of sources is explicitly not recommended by CMake, so will not be implemented.