diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 31b0deea5a..b33bf06778 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -276,7 +276,11 @@ end -- make the link flag function nf_link(self, lib) - return "-l" .. lib + if lib:endswith(".a") or lib:endswith(".so") or lib:endswith(".dylib") or lib:endswith(".lib") then + return lib + else + return "-l" .. lib + end end -- make the syslink flag diff --git a/xmake/modules/core/tools/link.lua b/xmake/modules/core/tools/link.lua index 87ba80b889..ee68cf01fa 100644 --- a/xmake/modules/core/tools/link.lua +++ b/xmake/modules/core/tools/link.lua @@ -100,7 +100,10 @@ end -- make the link flag function nf_link(self, lib) - return lib .. ".lib" + if not lib:endswith(".lib") then + lib = lib .. ".lib" + end + return lib end -- make the syslink flag diff --git a/xmake/modules/core/tools/nvcc.lua b/xmake/modules/core/tools/nvcc.lua index 17ee920c76..5d50017126 100644 --- a/xmake/modules/core/tools/nvcc.lua +++ b/xmake/modules/core/tools/nvcc.lua @@ -229,7 +229,11 @@ end -- make the link flag function nf_link(self, lib) - return "-l" .. lib + if lib:endswith(".a") or lib:endswith(".so") or lib:endswith(".dylib") or lib:endswith(".lib") then + return lib + else + return "-l" .. lib + end end -- make the syslink flag