From 4e751bd2feb3c29fb51fedc4d81c4e7db6e4b9ac Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 26 Feb 2021 00:00:24 +0800 Subject: improve to export links --- xmake/rules/utils/inherit_links/inherit_links.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/xmake/rules/utils/inherit_links/inherit_links.lua b/xmake/rules/utils/inherit_links/inherit_links.lua index 65e8bdce1..2a130aac0 100644 --- a/xmake/rules/utils/inherit_links/inherit_links.lua +++ b/xmake/rules/utils/inherit_links/inherit_links.lua @@ -53,10 +53,16 @@ function main(target) end -- we export all links and linkdirs in self/packages/options to the parent target by default - for _, name in ipairs({"frameworkdirs", "frameworks", "linkdirs", "links", "syslinks"}) do - local values = _get_values_from_target(target, name) - if values and #values > 0 then - target:add(name, values, {public = true}) + -- + -- @note we only export links for static target, + -- and we need pass `{public = true}` to add_packages/add_links/... to export it if want to export links for shared target + -- + if targetkind == "static" then + for _, name in ipairs({"frameworkdirs", "frameworks", "linkdirs", "links", "syslinks"}) do + local values = _get_values_from_target(target, name) + if values and #values > 0 then + target:add(name, values, {public = true}) + end end end end -- cgit v1.3.1