summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-07-16 22:56:29 +0800
committerruki <[email protected]>2024-07-16 22:56:29 +0800
commitd888f279d4a370e8dc913c43ba8f61596873d927 (patch)
tree468c60ec2e16054c27a4c16cc550dacedc63cdc0
parent47b8220c696df2fe33e8e24590d871feedfabf2a (diff)
add build.rpath and install.rpath policies
-rw-r--r--xmake/core/project/policy.lua4
-rw-r--r--xmake/rules/utils/inherit_links/inherit_links.lua2
2 files changed, 5 insertions, 1 deletions
diff --git a/xmake/core/project/policy.lua b/xmake/core/project/policy.lua
index 4b5ef9dae..74801d7eb 100644
--- a/xmake/core/project/policy.lua
+++ b/xmake/core/project/policy.lua
@@ -68,6 +68,8 @@ function policy.policies()
["build.sanitizer.leak"] = {description = "Enable leak sanitizer for c/c++ building.", type = "boolean"},
-- Enable undefined sanitizer for c/c++ building.
["build.sanitizer.undefined"] = {description = "Enable undefined sanitizer for c/c++ building.", type = "boolean"},
+ -- Enable build rpath
+ ["build.rpath"] = {description = "Enable build rpath.", default = true, type = "boolean"},
-- Enable C++ modules for C++ building, even if no .mpp is involved in the compilation
["build.c++.modules"] = {description = "Enable C++ modules for C++ building.", type = "boolean"},
-- Enable std module
@@ -94,6 +96,8 @@ function policy.policies()
["windows.manifest.uac.ui"] = {description = "Enable windows manifest UAC.", type = "boolean"},
-- Automatically build before running
["run.autobuild"] = {description = "Automatically build before running.", type = "boolean"},
+ -- Enable install rpath
+ ["install.rpath"] = {description = "Enable install rpath.", default = true, type = "boolean"},
-- Preprocessor configuration for ccache/distcc, we can disable linemarkers to speed up preprocess
["preprocessor.linemarkers"] = {description = "Enable linemarkers for preprocessor.", default = true, type = "boolean"},
-- Preprocessor configuration for ccache/distcc, we can disable it to avoid cache object file with __DATE__, __TIME__
diff --git a/xmake/rules/utils/inherit_links/inherit_links.lua b/xmake/rules/utils/inherit_links/inherit_links.lua
index b235c8bff..a128e1cb7 100644
--- a/xmake/rules/utils/inherit_links/inherit_links.lua
+++ b/xmake/rules/utils/inherit_links/inherit_links.lua
@@ -104,7 +104,7 @@ function main(target)
end
-- export rpathdirs for all shared library
- if target:is_binary() then
+ if target:is_binary() and target:policy("build.rpath") then
local targetdir = target:targetdir()
for _, dep in ipairs(target:orderdeps({inherit = true})) do
if dep:kind() == "shared" then