summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 382ab03e0..837e45faf 100644
--- a/xmake/core/project/config.lua
+++ b/xmake/core/project/config.lua
@@ -131,7 +131,14 @@ function config.buildir()
-- get the absolute path first
if not path.is_absolute(buildir) then
- buildir = path.absolute(buildir, os.projectdir())
+ 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()
+ else
+ rootdir = os.projectdir()
+ end
+ buildir = path.absolute(buildir, rootdir)
end
-- adjust path for the current directory
@@ -150,6 +157,7 @@ function config.directory()
if config._DIRECTORY == nil then
local rootdir = os.getenv("XMAKE_CONFIGDIR")
if not rootdir and 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