summaryrefslogtreecommitdiff
path: root/xmake/core/project/config.lua
diff options
context:
space:
mode:
authorOpportunity <[email protected]>2020-06-30 12:08:46 +0800
committerOpportunity <[email protected]>2020-06-30 12:08:46 +0800
commit6dd3577da0219a388ea2b3331cb9956c1e915dcd (patch)
tree5ea901dd29d0610f0fafe0f2c3bf6b85ff64dd4d /xmake/core/project/config.lua
parent58c8e709cc4677ec6fb5fdfcec1958fab6743709 (diff)
set defaults for buildir
Diffstat (limited to 'xmake/core/project/config.lua')
-rw-r--r--xmake/core/project/config.lua35
1 files changed, 17 insertions, 18 deletions
diff --git a/xmake/core/project/config.lua b/xmake/core/project/config.lua
index 837e45faf..90e4656a8 100644
--- a/xmake/core/project/config.lua
+++ b/xmake/core/project/config.lua
@@ -122,28 +122,27 @@ function config.options()
return configs
end
--- get the buildir
+-- get the buildir
function config.buildir()
-
- -- get it
- local buildir = config.get("buildir")
- if buildir then
- -- get the absolute path first
- if not path.is_absolute(buildir) then
- 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
+ -- get it
+ local buildir = config.get("buildir") or "build"
- -- adjust path for the current directory
- buildir = path.relative(buildir, os.curdir())
+ -- get the absolute path first
+ if not path.is_absolute(buildir) then
+ 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
+ buildir = path.relative(buildir, os.curdir())
+
return buildir
end