Problem 1805

Summary: Failing to configure with CLHEP-2.3.1.1
Product: Geant4 Reporter: Gabriele Cosmo <Gabriele.Cosmo>
Component: cmakeAssignee: Ben Morgan <Ben.Morgan>
Status: CLOSED FIXED    
Severity: major    
Priority: P5    
Version: 10.2   
Hardware: All   
OS: All   

Description Gabriele Cosmo 2015-12-14 17:40:44 CET
CMake fails to configure Geant4 10.2 with CLHEP-2.3.1.1 giving this error:

 (missing:  CLHEP_VERSION_COMPATIBLE) (Required is at least version "2.3.1.0")
Call Stack (most recent call first):
/usr/local/cmake/3.4.1/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:388 
(_FPHSA_FAILURE_MESSAGE)
  cmake/Modules/FindCLHEP.cmake:297 (find_package_handle_standard_args)
  cmake/Modules/Geant4OptionalComponents.cmake:58 (find_package)
  CMakeLists.txt:75 (include)
Comment 1 Ben Morgan 2015-12-15 12:34:49 CET
Diagnosed to change in CLHEP's public API in tweak release 2.3.1.1 - removal of 'PACKAGE_VERSION" definition in defs.h

Solution will be to remove FindCLHEP.cmake module and rely on CLHEP's CLHEPConfig.cmake config file. Work in progress...
Comment 2 Ben Morgan 2015-12-15 15:32:35 CET
Fix proposed for testing in tag cmake-V10-02-00
Comment 3 Gabriele Cosmo 2015-12-15 16:26:17 CET
Would it be more convenient to leave the FindCLHEP.cmake module for backwards compatibility?
Consider that if the fix has to be included in a patch, we cannot remove released files...
Comment 4 Ben Morgan 2015-12-15 16:36:52 CET
The fix is also compatible with CLHEP 2.3.1.0, and should also be so with preceding versions.
Comment 5 Gabriele Cosmo 2015-12-16 15:44:26 CET
That's good! For the sake of packaging the patch to release 10.2 itself, however, the file "FindCLHEP.cmake" will have to stay in the distribution, even if not used by the system. This is because we -cannot- remove released files from a patch (it means you should make a tag "cmake-V10-01-42" to leave 'internal', similar to "make-V10-02-01" but with that file included).
Comment 6 Ben Morgan 2015-12-16 19:17:19 CET
O.k., will do on adding the file back in.

If you can let me know the minimum version of CLHEP we need to support in the next round of patches, I can test the tag against these as well.
Comment 7 Gabriele Cosmo 2015-12-17 10:40:23 CET
For 10.2 series, the minimum required is 2.3.1.0, so it should be already OK.
For 10.0 and 10.1 series the "expected" versions are 2.1.4.1 and 2.2.0.4 respectively, but I believe what is reported as 'minimum' release in the CMake configuration for those releases should already be OK!
Comment 8 Ben Morgan 2015-12-17 14:52:18 CET
While I haven't tested this yet, I've gone back through the CLHEP configuration for 10.0.4 and 10.1.2. The issue as I see it is a combination of two things:

- Whether the GEANT4_USE_SYSTEM_CLHEP_GRANULAR option is supported
- Which CLHEP version is required/actually found

If GEANT4_USE_SYSTEM_CLHEP_GRANULAR is added into the patches (and it is in 10.1.2), then things will work provided CLHEP 2.3.1.0 or above is required (this is the first version to support granular, imported CMake targets properly).

If we require/allow patches to use versions of CLHEP earlier than 2.3.1.0, then the changes in cmake-V10-02-01 won't work. In that case, a mix of FindCLHEP and imported targets will be needed (I'd also recommend a bug report to CLHEP about not breaking the API in a tweak release...)
Comment 9 Gabriele Cosmo 2015-12-17 15:45:44 CET
Hi Ben, I don't quite understand what exactly is the problem. I believe the minimum CLHEP version as specified in the various release series should not change for future patches (it should in fact NEVER change in patches!).
2.3.1.0 and above should be used ONLY from release 10.2, as it works only for c++11 supported features.
Old releases and patches should stick to the old releases.
As for the use of granular CLHEP libraries, this is supported since release 10.1.p02, and to my knowledge it works with the CLHEP supported/recommended version for that release (i.e. 2.2.0.4). I would not change the CLHEP minimum version of 10.1 series for just that...
Comment 10 Ben Morgan 2015-12-17 21:27:41 CET
O.k., with the version non-changes I'd recommend the following:

- I'll patch FindCLHEP to handle the current versioning detection. We'll have to continue to use this until our minimum CLHEP version across all Geant4 versions being maintained is 2.3.1.0 or higher
- I'll maintain the migration to imported targets. This has significant benefits independent of the CLHEP issues and is worthwhile to support.

I have a 90% working patched FindCLHEP, but needs further testing outside Geant4. I'll then add it in to Geant4 for testing. Depending on problems along the way, this should be ready by early next week - but if not will be delayed until New Year.
Comment 11 Ben Morgan 2016-01-29 12:12:44 CET
Fixed in tag cmake-V10-02-02

- Improve REGEX used to detect CLHEP version
- Migrate to use of CMake Imported Targets