summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-06-14 17:25:52 +0800
committerruki <[email protected]>2020-06-14 17:25:52 +0800
commit6dbfda48d9aa8f84f39b0a16ddd18aa4860c3b50 (patch)
tree495cd014f8a91a625c2ed42456948e09d1780314
parent15285917960070cf3e747c66736da61b62fb005c (diff)
improve to detect sdk version
-rw-r--r--xmake/modules/detect/sdks/find_qt.lua13
1 files changed, 11 insertions, 2 deletions
diff --git a/xmake/modules/detect/sdks/find_qt.lua b/xmake/modules/detect/sdks/find_qt.lua
index 5ef3bd8b4..d0a29fa10 100644
--- a/xmake/modules/detect/sdks/find_qt.lua
+++ b/xmake/modules/detect/sdks/find_qt.lua
@@ -124,7 +124,8 @@ function _find_qt(sdkdir, sdkver)
-- get the bin directory
local bindir = path.join(sdkdir, "bin")
- if not os.isexec(path.join(bindir, "qmake")) then
+ local qmake = path.join(bindir, "qmake" .. (is_host("windows") and ".exe" or ""))
+ if not os.isexec(qmake) then
return nil
end
@@ -135,7 +136,15 @@ function _find_qt(sdkdir, sdkver)
local includedirs = {path.join(sdkdir, "include")}
-- get sdk version
- sdkver = sdkver or sdkdir:match("(%d+%.?%d*%.?%d*.-)")
+ if not sdkver then
+ sdkver = try {function () return os.iorunv(qmake, {"-query", "QT_VERSION"}) end}
+ if sdkver then
+ sdkver = sdkver:trim()
+ end
+ end
+ if not sdkver then
+ sdkver = sdkdir:match("(%d+%.?%d*%.?%d*.-)")
+ end
-- get toolchains
return {sdkdir = sdkdir, bindir = bindir, linkdirs = linkdirs, includedirs = includedirs, sdkver = sdkver}