From d2510d16dbb6812e2a23721f1de4467b32099a4e Mon Sep 17 00:00:00 2001 From: Arthur LAURENT Date: Fri, 9 May 2025 14:22:32 +0200 Subject: (cmake, meson) append shared/static libraries by default when relevent --- xmake/modules/package/tools/meson.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'xmake/modules/package/tools/meson.lua') diff --git a/xmake/modules/package/tools/meson.lua b/xmake/modules/package/tools/meson.lua index d03745b41..852f7124c 100644 --- a/xmake/modules/package/tools/meson.lua +++ b/xmake/modules/package/tools/meson.lua @@ -330,6 +330,7 @@ function _get_configs(package, configs, opt) -- add prefix configs = configs or {} + opt._configs_str = string.serialize(configs, {indent = false, strip = true}) table.insert(configs, "--prefix=" .. (opt.prefix or package:installdir())) table.insert(configs, "--libdir=lib") @@ -351,6 +352,14 @@ function _get_configs(package, configs, opt) table.insert(configs, "-Db_sanitize=address") end + -- add library kind + if package:is_library() then + local has_already_libflag = opt._configs_str and opt._configs_str:find("default_library", 1, true) + if not has_already_libflag then + table.insert(configs, "-Ddefault_library=".. (package:config("shared") and "shared" or "static")) + end + end + -- add vs runtimes flags if package:is_plat("windows") then table.insert(configs, "--vsenv") -- cgit v1.3.1