diff --git a/xmake/modules/target/action/install/main.lua b/xmake/modules/target/action/install/main.lua index 6eecfaba45e..228cabd1ac7 100644 --- a/xmake/modules/target/action/install/main.lua +++ b/xmake/modules/target/action/install/main.lua @@ -158,7 +158,6 @@ function _update_install_rpath(target, opt) local bindir = target:bindir() local targetfile = path.join(bindir, target:filename()) if target:policy("install.rpath") then - rpath_utils.clean(targetfile, {plat = target:plat(), arch = target:arch()}) local result, sources = target:get_from("rpathdirs", "*") if result and sources then for idx, rpathdirs in ipairs(result) do @@ -169,6 +168,8 @@ function _update_install_rpath(target, opt) local extra = extraconf[rpathdir] if extra and extra.installonly then rpath_utils.insert(targetfile, rpathdir, {plat = target:plat(), arch = target:arch()}) + else + rpath_utils.remove(targetfile, rpathdir, {plat = target:plat(), arch = target:arch()}) end end end