From 0898fd246104e549351ecf58007314524825479f Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 29 Jun 2023 22:42:21 +0800 Subject: [PATCH] support lib path for add_links #3889 --- xmake/modules/core/tools/gcc.lua | 6 +++++- xmake/modules/core/tools/link.lua | 5 ++++- xmake/modules/core/tools/nvcc.lua | 6 +++++- 3 files changed, 14 insertions(+), 3 deletions(-) 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