diff --git a/meson.build b/meson.build index a46aae642..1b8be0b02 100644 --- a/meson.build +++ b/meson.build @@ -173,11 +173,18 @@ endif enable_lto = get_option('b_lto') if enable_lto - # meson already adds '-flto' - lto_flag = '-flto-partition=none' - assert(cc.has_argument(lto_flag), '-flto-partition=none not supported. Disable link-time optimization with -Db_lto=false.') - common_flags += lto_flag - common_ldflags += lto_flag + if cc.get_id() == 'clang' + clang_version = cc.version() + if clang_version <= '18.0.0' + error('Clang version should be greater then 18.0.0 got : ' + clang_version) + endif + else + # Meson already adds '-flto' + lto_flag = '-flto-partition=none' + assert(cc.has_argument(lto_flag), '-flto-partition=none not supported. Disable link-time optimization with -Db_lto=false.') + common_flags += lto_flag + common_ldflags += lto_flag + endif endif common_flags += cc.get_supported_arguments([