summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-09-03 00:40:11 +0800
committerruki <[email protected]>2022-09-03 00:40:11 +0800
commite59566a7d6f7ce12b1f132b335a8788b8050e8ae (patch)
tree2065a50ce2ee3d3933e92bcb507c2fdc18d7d0fb
parent25caa4753e423242d1757552fa5080c508b5cb0c (diff)
improve buildir
-rw-r--r--xmake/core/project/config.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/xmake/core/project/config.lua b/xmake/core/project/config.lua
index 2d0984a91..bf68e93a8 100644
--- a/xmake/core/project/config.lua
+++ b/xmake/core/project/config.lua
@@ -95,9 +95,17 @@ function config.buildir(opt)
-- get the absolute path first
opt = opt or {}
+ local rootdir
+ if os.isdir(path.join(os.workingdir(), ".xmake")) then
+ -- we switch to independent working directory @see https://github.com/xmake-io/xmake/issues/820
+ rootdir = os.workingdir()
+ end
+ if not rootdir then
+ rootdir = os.projectdir()
+ end
local buildir = config.get("buildir") or "build"
if not path.is_absolute(buildir) then
- buildir = path.absolute(buildir, os.projectdir())
+ buildir = path.absolute(buildir, rootdir)
end
-- adjust path for the current directory