build: allow building with clang+lto
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2053
This commit is contained in:

committed by
Lubomir Rintel

parent
fd1a5b3c4b
commit
40c187dc15
17
meson.build
17
meson.build
@@ -173,11 +173,18 @@ endif
|
|||||||
|
|
||||||
enable_lto = get_option('b_lto')
|
enable_lto = get_option('b_lto')
|
||||||
if enable_lto
|
if enable_lto
|
||||||
# meson already adds '-flto'
|
if cc.get_id() == 'clang'
|
||||||
lto_flag = '-flto-partition=none'
|
clang_version = cc.version()
|
||||||
assert(cc.has_argument(lto_flag), '-flto-partition=none not supported. Disable link-time optimization with -Db_lto=false.')
|
if clang_version <= '18.0.0'
|
||||||
common_flags += lto_flag
|
error('Clang version should be greater then 18.0.0 got : ' + clang_version)
|
||||||
common_ldflags += lto_flag
|
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
|
endif
|
||||||
|
|
||||||
common_flags += cc.get_supported_arguments([
|
common_flags += cc.get_supported_arguments([
|
||||||
|
Reference in New Issue
Block a user