summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/gcc.lua
diff options
context:
space:
mode:
authorSineStriker <[email protected]>2025-04-19 03:18:11 +0800
committerruki <[email protected]>2025-04-23 11:30:30 +0800
commit065761c9a6ac381458850efbd3185628eccd9a2a (patch)
treed79679d969e7259855a705231e749c31965bc05c /xmake/modules/core/tools/gcc.lua
parent6551ed38c1250c0c41eada6db14f8601bf3ddb64 (diff)
Fix nil value exception in link proc when target type is package during package testing
Diffstat (limited to 'xmake/modules/core/tools/gcc.lua')
-rw-r--r--xmake/modules/core/tools/gcc.lua9
1 files changed, 3 insertions, 6 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 09a5b589e..48e2ebe73 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -575,10 +575,7 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags, opt)
-- add `-Wl,--out-implib,outputdir/libxxx.a` for xxx.dll on mingw/gcc
if targetkind == "shared" and self:is_plat("mingw") then
- local implibdir = path.directory(targetfile)
- if opt.target then
- implibdir = opt.target:implibdir()
- end
+ local implibdir = opt.implibdir or path.directory(targetfile)
table.insert(flags_extra, "-Wl,--out-implib," .. path.join(implibdir, path.basename(targetfile) .. ".dll.a"))
end
@@ -601,8 +598,8 @@ function link(self, objectfiles, targetkind, targetfile, flags, opt)
os.mkdir(path.directory(targetfile))
-- ensure the implib directory
- if opt and opt.target and opt.target:implibdir() then
- os.mkdir(opt.target:implibdir())
+ if opt.implibdir then
+ os.mkdir(opt.implibdir)
end
local program, argv = linkargv(self, objectfiles, targetkind, targetfile, flags, opt)