Search code examples
ccmakecompilationintermediate-languagelto

Why does CMake set -no-fat-lto-objects when I enable LTO/IPO?


I'm enabling IPO (inter-procedural optimization) for a C compilation of mine, using CMake:

set_property(TARGET foo PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)

As expected, this causes an -flto compiler flag to be added. However, it also adds -fno-fat-lto-objects: That means that the resulting object file will only have intermediate code, rather than both properly-compiled and intermediate code; and that means that the linker must support my system compiler's intermediate representation and be IPO/LTO-aware.

I didn't ask for -fno-fat-lto-objects, nor did I want it. Can I get CMake to not add this option?


Solution

  • I believe this is a CMake bug... which I have now filed:

    The developers have simply made the incorrect assumption that this is what people want.