https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117598
Ivan Zrno <ivan.zrno2 at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|WORKSFORME |FIXED --- Comment #7 from Ivan Zrno <ivan.zrno2 at gmail dot com> --- Thanks for all the help, I think I found the explanation. I need to set the compile time options AND THE link time options. target_compile_options(MyProgram PRIVATE -fstack-usage) target_link_options(MyProgram PRIVATE -fstack-usage) just setting the compile time options is not enough. It also doesn't matter if I manually add -flto or set the CMAKE INTERPROCEDURAL_OPTIMIZATION to ON