From fa34c04745a093ebcc34d9dfd2da5623c3f3148c Mon Sep 17 00:00:00 2001 From: Elite-stay <344233108@qq.com> Date: Fri, 8 Nov 2024 17:33:43 +0800 Subject: [PATCH 1/2] Improve user experience --- xmake/modules/detect/sdks/find_qt.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xmake/modules/detect/sdks/find_qt.lua b/xmake/modules/detect/sdks/find_qt.lua index 5cb77f9ad42..9d09ea621fb 100644 --- a/xmake/modules/detect/sdks/find_qt.lua +++ b/xmake/modules/detect/sdks/find_qt.lua @@ -200,8 +200,12 @@ function _get_qtenvs(qmake) envs[kv[1]] = kv[2]:trim() end end + return envs + else + if option.get("verbose") then + print("qmake -query failed") + end end - return envs end -- find qt sdk toolchains From b644871f11652acb0b77f7e480f7b10ce0ea1715 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 8 Nov 2024 20:22:31 +0800 Subject: [PATCH 2/2] Update find_qt.lua --- xmake/modules/detect/sdks/find_qt.lua | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/xmake/modules/detect/sdks/find_qt.lua b/xmake/modules/detect/sdks/find_qt.lua index 9d09ea621fb..1a9e79f7656 100644 --- a/xmake/modules/detect/sdks/find_qt.lua +++ b/xmake/modules/detect/sdks/find_qt.lua @@ -192,7 +192,18 @@ end -- get qt environment function _get_qtenvs(qmake) local envs = {} - local results = try {function () return os.iorunv(qmake, {"-query"}) end} + local results = try { + function () + return os.iorunv(qmake, {"-query"}) + end, + catch { + function (errors) + if errors then + dprint(tostring(errors)) + end + end + } + } if results then for _, qtenv in ipairs(results:split('\n', {plain = true})) do local kv = qtenv:split(':', {plain = true, limit = 2}) -- @note set limit = 2 for supporting value with win-style path, e.g. `key:C:\xxx` @@ -201,10 +212,6 @@ function _get_qtenvs(qmake) end end return envs - else - if option.get("verbose") then - print("qmake -query failed") - end end end