Skip to content

Commit

Permalink
improve to find_gcc #4429
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Nov 28, 2023
1 parent 7219060 commit 0c66e77
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions xmake/modules/detect/tools/find_gcc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
-- imports
import("lib.detect.find_program")
import("lib.detect.find_programver")
import("core.cache.detectcache")

-- find gcc
--
Expand All @@ -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
Expand Down

0 comments on commit 0c66e77

Please sign in to comment.