From cf59b0d2890715666ff1a30631f7541cebf5f48e Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 31 Jul 2025 23:32:31 +0800 Subject: fix remove files #6652 --- xmake/core/project/target.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 4923283f6..78719105b 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -2002,13 +2002,14 @@ function _instance:sourcefiles() removed = true end - -- find source files and try to cache the matching results of os.match across targets - -- @see https://github.com/xmake-io/xmake/issues/1353 - local results = targetcache:get2("sourcefiles", file) - if not results then - if removed then - results = {file} - else + local results + if removed then + results = {file} + else + -- find source files and try to cache the matching results of os.match across targets + -- @see https://github.com/xmake-io/xmake/issues/1353 + results = targetcache:get2("sourcefiles", file) + if results == nil then results = os.files(file) if #results == 0 then -- attempt to find source directories if maybe compile it as directory with the custom rules -- cgit v1.3.1