Use CMake's system for IPO/LTO

Resolves #5265 (closed). Supersedes https://github.com/OpenMW/openmw/pull/2686.

I've not tested this myself yet, I just rebased Eli2's attempt, fixed the merge conflicts, and tweaked it a little. CI should cover the non-LTO case, but it could do with people trying LTO.

Another thought - maybe we should enable LTO for Release CI builds. They'll probably take longer, but it'll make nightlies more playable. Maybe just for on-merge master-branch builds rather than MRs.

Merge request reports

Loading