diff --git a/xmake/modules/detect/sdks/find_qt.lua b/xmake/modules/detect/sdks/find_qt.lua index 5cb77f9ad4..1a9e79f765 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` @@ -200,8 +211,8 @@ function _get_qtenvs(qmake) envs[kv[1]] = kv[2]:trim() end end + return envs end - return envs end -- find qt sdk toolchains