diff options
| author | ruki <[email protected]> | 2024-04-01 18:06:51 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-04-01 18:06:51 +0800 |
| commit | 294c31f0d558eb23f60309d4fb1793372de8073c (patch) | |
| tree | 6ad6881f0b7c93c9b6b08da93a39349f4707f0a8 | |
| parent | 0a6b4953c793011f5a786214eb8f510ee0aad6aa (diff) | |
| parent | d8c9790454b1de10f38f9334facea7f00d3ad332 (diff) | |
Merge pull request #4910 from xmake-io/qmake
Improve to find qmake
| -rw-r--r-- | xmake/modules/detect/sdks/find_qt.lua | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/xmake/modules/detect/sdks/find_qt.lua b/xmake/modules/detect/sdks/find_qt.lua index d141eee3a..5cb77f9ad 100644 --- a/xmake/modules/detect/sdks/find_qt.lua +++ b/xmake/modules/detect/sdks/find_qt.lua @@ -134,7 +134,19 @@ function _find_sdkdir(sdkdir, sdkver) end -- attempt to find qmake - local qmake = find_file(is_host("windows") and "qmake.exe" or "qmake", paths, {suffixes = subdirs}) + local qmake + if is_host("windows") then + qmake = find_file("qmake.exe", paths, {suffixes = subdirs}) + else + -- @see https://github.com/xmake-io/xmake/issues/4881 + if sdkver then + local major = sdkver:sub(1, 1) + qmake = find_file("qmake" .. major, paths, {suffixes = subdirs}) + end + if not qmake then + qmake = find_file("qmake", paths, {suffixes = subdirs}) + end + end if qmake then return path.directory(path.directory(qmake)), qmake end @@ -155,7 +167,8 @@ function _find_qmake(sdkdir, sdkver) if sdkver then sdkver = semver.try_parse(sdkver) if sdkver then - qmake = find_tool("qmake", {program = "qmake" .. sdkver:major(), paths = sdkdir and path.join(sdkdir, "bin")}) + local cachekey = "qmake-" .. sdkver:major() + qmake = find_tool("qmake", {program = "qmake" .. sdkver:major(), cachekey = cachekey, paths = sdkdir and path.join(sdkdir, "bin")}) end end @@ -164,7 +177,8 @@ function _find_qmake(sdkdir, sdkver) if not qmake then local suffixes = {"", "6", "-qt5"} for _, suffix in ipairs(suffixes) do - qmake = find_tool("qmake", {program = "qmake" .. suffix, paths = sdkdir and path.join(sdkdir, "bin")}) + local cachekey = "qmake-" .. suffix + qmake = find_tool("qmake", {program = "qmake" .. suffix, cachekey = cachekey, paths = sdkdir and path.join(sdkdir, "bin")}) if qmake then break end |
