From 5bfd1037e798369de9896cf792eab3b8191e9d6a Mon Sep 17 00:00:00 2001 From: Doekin Date: Sat, 7 Jun 2025 00:45:04 +0800 Subject: fix(find_qt): gracefully handle unsupported `-qtconf` argument --- xmake/modules/detect/sdks/find_qt.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xmake/modules/detect/sdks/find_qt.lua b/xmake/modules/detect/sdks/find_qt.lua index 29eb65e73..c1b526673 100644 --- a/xmake/modules/detect/sdks/find_qt.lua +++ b/xmake/modules/detect/sdks/find_qt.lua @@ -205,19 +205,23 @@ end -- get qt environment function _get_qtenvs(qmake, sdkdir) local envs = {} - local run_args = {"-query"} + local results + + -- Try with -qtconf first if sdkdir is provided if sdkdir then local conf_paths = {path.join(sdkdir, "bin", "target_qt.conf"), path.join(sdkdir, "bin", "qt.conf")} for _, conf_path in ipairs(conf_paths) do if os.isfile(conf_path) then - table.join2(run_args, {"-qtconf", conf_path}) + results = try {function () return os.iorunv(qmake, {"-query", "-qtconf", conf_path}) end} break end end end - local results = try { + + -- Fallback to normal query if sdkdir is not specified or -qtconf not applicable + results = results or try { function () - return os.iorunv(qmake, run_args) + return os.iorunv(qmake, {"-query"}) end, catch { function (errors) -- cgit v1.3.1