From 58c774526e620fbee7d3e7bf6172bdcbe3aa6256 Mon Sep 17 00:00:00 2001 From: wps <19317362@qq.com> Date: Thu, 19 Dec 2024 17:44:32 +0800 Subject: [fix] error path escape for windows + android ndk --sysroot= c: path/to/ndk and -isystem c: path/to/ndk --- xmake/plugins/project/cmake/cmakelists.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index 598a1aad3..5135d7585 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -104,7 +104,10 @@ end -- escape path in flag -- @see https://github.com/xmake-io/xmake/issues/3161 function _escape_path_in_flag(target, flag) - if is_host("windows") and target:has_tool("cc", "cl") then + + if is_host("windows") and (target:has_tool("cc", "cl") + or target:is_plat("android") -- e.g. -isystem\ c:/path/to/ndk/28.0.12674087/ + ) then -- e.g. /ManifestInput:xx, /def:xxx if flag:find(":", 1, true) then flag = _escape_path(flag) -- cgit v1.3.1 From 11a26d2b1e4aed7b817b0f8bc4c0ac0e99013f7e Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 19 Dec 2024 23:45:52 +0800 Subject: Update cmakelists.lua --- xmake/plugins/project/cmake/cmakelists.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index 5135d7585..22edabcd2 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -104,12 +104,9 @@ end -- escape path in flag -- @see https://github.com/xmake-io/xmake/issues/3161 function _escape_path_in_flag(target, flag) - - if is_host("windows") and (target:has_tool("cc", "cl") - or target:is_plat("android") -- e.g. -isystem\ c:/path/to/ndk/28.0.12674087/ - ) then - -- e.g. /ManifestInput:xx, /def:xxx - if flag:find(":", 1, true) then + if is_host("windows") then + -- e.g. /ManifestInput:..\..\, /def:xxx, -isystem c:\xxx, -Ic:\.. + if flag:find("\\", 1, true) then flag = _escape_path(flag) end end -- cgit v1.3.1