diff options
| author | ruki <[email protected]> | 2023-11-29 00:56:14 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-11-29 00:56:14 +0800 |
| commit | 0c66e771ba66bad764c264467c5e7fd2f2c34add (patch) | |
| tree | 23f349727c8eec6d2c54ba3307ceaf2f32414218 | |
| parent | 72190603ad0a04debb978c2ba79a0e69dabe473e (diff) | |
improve to find_gcc #4429
| -rw-r--r-- | xmake/modules/detect/tools/find_gcc.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/xmake/modules/detect/tools/find_gcc.lua b/xmake/modules/detect/tools/find_gcc.lua index 228b60094..7096e8e00 100644 --- a/xmake/modules/detect/tools/find_gcc.lua +++ b/xmake/modules/detect/tools/find_gcc.lua @@ -21,6 +21,7 @@ -- imports import("lib.detect.find_program") import("lib.detect.find_programver") +import("core.cache.detectcache") -- find gcc -- @@ -44,8 +45,13 @@ function main(opt) end local is_clang = false - if program then - local versioninfo = os.iorunv(program, {"--version"}, {envs = opt.envs}) + if program and is_host("macosx") then + local cachekey = "find_gcc_versioninfo_" .. program + local versioninfo = detectcache:get(cachekey) + if versioninfo == nil then + versioninfo = os.iorunv(program, {"--version"}, {envs = opt.envs}) + detectcache:set(cachekey, versioninfo) + end if versioninfo and versioninfo:find("clang", 1, true) then is_clang = true end |
