summaryrefslogtreecommitdiff
path: root/xmake/modules/package/tools/meson.lua
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2025-05-09 14:22:32 +0200
committerArthur LAURENT <[email protected]>2025-05-09 14:22:32 +0200
commitd2510d16dbb6812e2a23721f1de4467b32099a4e (patch)
tree6ba7405e99dca1f7644dd05ae6583b6ea41bbc12 /xmake/modules/package/tools/meson.lua
parent93c6fb1a2a7dbe2a320fa51ce3fd71818fb89d09 (diff)
(cmake, meson) append shared/static libraries by default when relevent
Diffstat (limited to 'xmake/modules/package/tools/meson.lua')
-rw-r--r--xmake/modules/package/tools/meson.lua9
1 files changed, 9 insertions, 0 deletions
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")