CMake option to disable LTO?

Hello LLVM,
When building LLVM/Clang (debug build), linking takes too long. I
notice that LTO is enabled now and guess that's to blame. Is there a
CMAKE config option to disable LTO linking? I can't seem to find
anything.

Thanks,
-steve

Hi,

There is no option (that I know of) to enable/disable LTO (it shouldn’t be enabled) other than setting it explicitly in the CMAKE_C_FLAG/CMAKE_CXX_FLAG.

Are you sure LTO is enabled? What it the value of CMAKE_C_FLAG/CMAKE_CXX_FLAG in your CMakeCache.txt?

Thanks Mehdi, I think I'm mistaken about LTO. During linking, my gcc
5.3 loads liblto_plugin.so and lto_wrapper and so on, but I don't see
the -flto option to actually enable it. Must be something else
clogging my build.

I think it'd be a bug if you got LTO by default with a debug build.
What platform are you on? What cmake command did you use when
configuring?

It is probably just an oddity of building with current gcc: