From 6dbfda48d9aa8f84f39b0a16ddd18aa4860c3b50 Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 14 Jun 2020 17:25:52 +0800 Subject: improve to detect sdk version --- xmake/modules/detect/sdks/find_qt.lua | 13 +++++++++++-- 1 file 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} -- cgit v1.3.1