diff options
| author | ruki <[email protected]> | 2025-09-17 00:52:40 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-09-17 00:52:40 +0800 |
| commit | 63c49fb4d349a51899a04a6de77e79623cfa43f1 (patch) | |
| tree | 8881ca0d9d664fb7a3447148b29b1052aa060371 | |
| parent | f9e895a3d33d021d4ddda6be9dfc4bacf358e6ea (diff) | |
improve to find gcc/clang
| -rw-r--r-- | xmake/core/sandbox/modules/import/lib/detect/find_program.lua | 3 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_clang.lua | 1 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_clangxx.lua | 1 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_gcc.lua | 1 | ||||
| -rw-r--r-- | xmake/modules/detect/tools/find_gxx.lua | 2 |
5 files changed, 7 insertions, 1 deletions
diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua index 7c53d0a03..858b413e8 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua @@ -43,6 +43,8 @@ function sandbox_lib_detect_find_program._do_check(program, opt) -- do not attempt to run program? check it fastly if opt.norun then return os.isfile(program) + elseif opt.norunfile and path.is_absolute(program) and os.isfile(program) then + return true end -- no check script? attempt to run it directly @@ -295,6 +297,7 @@ end -- - opt.paths the program paths (e.g. dirs, paths, winreg paths, script paths) -- - opt.check the check script or command -- - opt.norun do not attempt to run program to check program fastly +-- - opt.norunfile do not attempt to run program to check program if it's valid file path. -- - opt.system true: only find it from system, false: only find it from xmake/packages -- -- @return the program name or path diff --git a/xmake/modules/detect/tools/find_clang.lua b/xmake/modules/detect/tools/find_clang.lua index 764a7beb5..6f742b774 100644 --- a/xmake/modules/detect/tools/find_clang.lua +++ b/xmake/modules/detect/tools/find_clang.lua @@ -37,6 +37,7 @@ import("lib.detect.find_programver") -- function main(opt) opt = opt or {} + opt.norunfile = true local program = find_program(opt.program or "clang", opt) local version = nil if program and opt and opt.version then diff --git a/xmake/modules/detect/tools/find_clangxx.lua b/xmake/modules/detect/tools/find_clangxx.lua index c6dba4d6a..a48fa99cc 100644 --- a/xmake/modules/detect/tools/find_clangxx.lua +++ b/xmake/modules/detect/tools/find_clangxx.lua @@ -37,6 +37,7 @@ import("lib.detect.find_programver") -- function main(opt) opt = opt or {} + opt.norunfile = true local program = find_program(opt.program or "clang++", opt) local version = nil if program and opt and opt.version then diff --git a/xmake/modules/detect/tools/find_gcc.lua b/xmake/modules/detect/tools/find_gcc.lua index d63c5d1b6..b8c7b71a5 100644 --- a/xmake/modules/detect/tools/find_gcc.lua +++ b/xmake/modules/detect/tools/find_gcc.lua @@ -53,6 +53,7 @@ end -- function main(opt) opt = opt or {} + opt.norunfile = true local program = find_program(opt.program or "gcc", opt) local version = nil if program and opt.version then diff --git a/xmake/modules/detect/tools/find_gxx.lua b/xmake/modules/detect/tools/find_gxx.lua index f218dc415..c25248541 100644 --- a/xmake/modules/detect/tools/find_gxx.lua +++ b/xmake/modules/detect/tools/find_gxx.lua @@ -37,8 +37,8 @@ import("detect.tools.find_gcc") -- @endcode -- function main(opt) - opt = opt or {} + opt.norunfile = true local program = find_program(opt.program or "g++", opt) local version = nil if program and opt and opt.version then |
