| Summary: | Changes to FindEXPAT in CMake 3.27 break Geant4PackageCache.cmake file | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | Ben Morgan <Ben.Morgan> |
| Component: | cmake | Assignee: | Ben Morgan <Ben.Morgan> |
| Status: | CLOSED FIXED | ||
| Severity: | normal | CC: | greenc |
| Priority: | P4 | ||
| Version: | 11.1 | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: | Patch to support package cache output with CMake >= 3.27 | ||
|
Description
Ben Morgan
2023-07-28 16:02:05 CEST
Created attachment 821 [details]
Patch to support package cache output with CMake >= 3.27
The attached patch can be applied cleanly to Geant4 10.7 through to 11.2-beta. It has been tested on each version with various combinations of build/use time CMake versions albeit not exhaustively.
It is merged to the development branch and so will be in the 11.2 release, with application to preceeding versions in the next patches to these releases.
Will leave assigned until patches are fully deployed. After reading the CMake code here, I'm pretty sure that saving `EXPAT_LIBRARY` (or any other variable produced by `find_package(dep...)` is unnecessary because of the use of `find_dependency()` in the Config file itself. It's necessary(*) for the use case where the needed packages are in locations that CMake may not know about after package install. For example, `CMAKE_PREFIX_PATH` is set at install time with a load of non-standard locations, but not at application build time. A packaging system will almost certainly handle this, but custom/personal installs may not. (*) They are strong arguments on both sides to delete/retain the package cache functionality, hence the default to install it (to help novice/inexperienced users), but switch that off if required. Closing as resolved as deployed in 11.2 and 11.1 patches. Can refer back to this in future for older releases if needed. |