Skip to content

Commit 0b78f9a

Browse files
authored
update: find qt by qt_sdkver option
1 parent 77bd76e commit 0b78f9a

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

xmake/modules/detect/sdks/find_qt.lua

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,13 @@ function _find_sdkdir(sdkdir, sdkver)
141141
-- @see https://github.com/xmake-io/xmake/issues/4881
142142
if sdkver then
143143
local major = sdkver:sub(1, 1)
144-
qmake = find_file("qmake" .. major, paths, {suffixes = subdirs})
144+
local suffixes = {major, "-" .. major, "-qt" .. major, ""}
145+
for _, suffix in ipairs(suffixes) do
146+
qmake = find_file("qmake" .. suffix, paths, {suffixes = subdirs})
147+
if qmake then
148+
break
149+
end
150+
end
145151
end
146152
if not qmake then
147153
qmake = find_file("qmake", paths, {suffixes = subdirs})
@@ -167,18 +173,25 @@ function _find_qmake(sdkdir, sdkver)
167173
if sdkver then
168174
sdkver = semver.try_parse(sdkver)
169175
if sdkver then
170-
local cachekey = "qmake-" .. sdkver:major()
171-
qmake = find_tool("qmake", {program = "qmake" .. sdkver:major(), cachekey = cachekey, paths = sdkdir and path.join(sdkdir, "bin")})
176+
local major = sdkver:major()
177+
local suffixes = {major, "-" .. major, "-qt" .. major}
178+
for _, suffix in ipairs(suffixes) do
179+
local cachekey = "qmake" .. suffix
180+
qmake = find_tool("qmake", {program = cachekey, cachekey = cachekey, paths = sdkdir and path.join(sdkdir, "bin")})
181+
if qmake then
182+
break
183+
end
184+
end
172185
end
173186
end
174187

175188
-- we need to find the default qmake in current system
176189
-- maybe we only installed qmake6
177190
if not qmake then
178-
local suffixes = {"", "6", "-qt5"}
191+
local suffixes = {"", "6", "-6", "-qt6", "5", "-5", "-qt5"}
179192
for _, suffix in ipairs(suffixes) do
180-
local cachekey = "qmake-" .. suffix
181-
qmake = find_tool("qmake", {program = "qmake" .. suffix, cachekey = cachekey, paths = sdkdir and path.join(sdkdir, "bin")})
193+
local cachekey = "qmake" .. suffix
194+
qmake = find_tool("qmake", {program = cachekey, cachekey = cachekey, paths = sdkdir and path.join(sdkdir, "bin")})
182195
if qmake then
183196
break
184197
end

0 commit comments

Comments
 (0)