Add optional LTO builds of AtlasGeant4 in Athena and AthSimulation
Originally implemented for 24.0 in !70253 (merged), the changes were swept into main
under !70974 (merged), but this ignored the changes needed under Projects
. This lead to build failures and the revert of the sweep of the changes in !70253 (merged).
This "reverts the revert" and cherry-picks the additional commit with the changes to the CMake scripts in Projects
. The overall changes are thus:
Use of LTO in Athena builds is not currently possible if the GCC checker plugins are in use. These are not yet LTO-aware, leading to build errors. Disabling these globally or per-LTO-using-package is not feasible as it could lead to the introduction of bad code.
Whilst the plugins are made LTO-aware, introduce CMake option in Athena and AthSimulation for enabling LTO builds of the AtlasGeant4 "big" library. Set to OFF by default so that "normal" builds are unaffected. Builds wanting LTO can set the option to ON, but must also set ATLAS_USE_GCC_CHECKERS to OFF in this case.
Set INTERPROCEDURAL_OPTIMIZATION target property on all targets composed into AtlasGeant4Lib/AtlasGeant when ATLAS_GEANT4_USE_LTO option is set.
Follow up to ATLASSIM-6058. Ideally should co-work with an update to atlasexternals
for main
in preparation by @akraszna which brings in the optional builds of Geant4 and VecGeom with LTO. However, the changes here can be tested in isolation as the option is OFF
by default and thus should not change anything in CI or otherwise "default" builds.