From f40cd6da49ed65067d4c6060fa3605cdbd994499 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 15 Nov 2022 22:54:27 +0800 Subject: clean msvc import library #3052 --- xmake/modules/target/action/clean/main.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/xmake/modules/target/action/clean/main.lua b/xmake/modules/target/action/clean/main.lua index 74ebf39bb..8871ca21f 100644 --- a/xmake/modules/target/action/clean/main.lua +++ b/xmake/modules/target/action/clean/main.lua @@ -32,7 +32,19 @@ function main(target) end -- remove the target file - remove_files(target:targetfile()) + local targetfile = target:targetfile() + remove_files(targetfile) + + -- remove import library of the target file + -- @see https://github.com/xmake-io/xmake/issues/3052 + if target:is_plat("windows") and target:is_shared() then + local expfile = path.join(path.directory(targetfile), path.basename(targetfile) .. ".exp") + local libfile = path.join(path.directory(targetfile), path.basename(targetfile) .. ".lib") + if os.isfile(expfile) then + remove_files(libfile) + remove_files(expfile) + end + end -- remove the symbol file remove_files(target:symbolfile()) -- cgit v1.3.1