diff --git a/nc_optimisation.cmake b/nc_optimisation.cmake index b2b097c..95a589a 100644 --- a/nc_optimisation.cmake +++ b/nc_optimisation.cmake @@ -26,11 +26,21 @@ if (LTO) # Add the linker flags first otherwise the linker may not recognise the # object format append_link_flag("-fuse-linker-plugin") - append_link_flag("-flto") + # HACK: we shouldn't use 'auto' as it will likely lead to oversubscription + # but I'm sick of holding GCC's hand today. + append_first_link_flag("-flto=auto" "-flto") # Enable LTO on the compilation side, but try very hard to avoid # situations where we may accidentally use regular/fat objects. - append_compile_flag("-flto") + # + # GCC 12 will emit a warning about serial compilation of LTRANS jobs if an + # explicit parameter is not passed. It must be an integer, auto, or + # jobserver. + # Clang will only accept 'full', 'thin', or no argument. + # + # HACK: we shouldn't use 'auto' as it will likely lead to oversubscription + # but I'm sick of holding GCC's hand today. + append_first_compile_flag("-flto=auto" "-flto") append_compile_flag("-fno-fat-lto-objects") append_compile_flag("-flto-jobs=0")