summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-03-10 21:52:39 +0800
committerruki <[email protected]>2024-03-10 21:52:45 +0800
commit16e8c3532b8ff54dadea579cc9525e63bfbf013d (patch)
tree8cc4cdbebb39726b4020dec15fa994b9eac50b1f
parent979b1216dcd7f3f9fe8b220ac050901b42f5cae9 (diff)
fix cmakelist #4816
-rw-r--r--xmake/plugins/project/cmake/cmakelists.lua23
1 files changed, 13 insertions, 10 deletions
diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua
index 5bbcf05fe..b4dfe8bce 100644
--- a/xmake/plugins/project/cmake/cmakelists.lua
+++ b/xmake/plugins/project/cmake/cmakelists.lua
@@ -196,16 +196,19 @@ function _translate_flag(flag, outputdir)
if flag then
if path.instance_of(flag) then
flag = flag:clone():set(_get_relative_unix_path_to_cmake(flag:rawstr(), outputdir)):str()
- elseif path.is_absolute(flag) then
- flag = _get_relative_unix_path_to_cmake(flag, outputdir)
- elseif flag:startswith("-fmodule-file=") then
- flag = "-fmodule-file=" .. _get_relative_unix_path_to_cmake(flag:sub(15), outputdir)
- elseif flag:startswith("-fmodule-mapper=") then
- flag = "-fmodule-mapper=" .. _get_relative_unix_path_to_cmake(flag:sub(17), outputdir)
- elseif flag:match("(.+)=(.+)") then
- local k, v = flag:match("(.+)=(.+)")
- if v and (v:endswith(".ifc") or v:endswith(".map")) then -- e.g. hello=xxx/hello.ifc
- flag = k .. "=" .. _get_relative_unix_path_to_cmake(v, outputdir)
+ -- it may be table, https://github.com/xmake-io/xmake/issues/4816
+ elseif type(flag) == "string" then
+ if path.is_absolute(flag) then
+ flag = _get_relative_unix_path_to_cmake(flag, outputdir)
+ elseif flag:startswith("-fmodule-file=") then
+ flag = "-fmodule-file=" .. _get_relative_unix_path_to_cmake(flag:sub(15), outputdir)
+ elseif flag:startswith("-fmodule-mapper=") then
+ flag = "-fmodule-mapper=" .. _get_relative_unix_path_to_cmake(flag:sub(17), outputdir)
+ elseif flag:match("(.+)=(.+)") then
+ local k, v = flag:match("(.+)=(.+)")
+ if v and (v:endswith(".ifc") or v:endswith(".map")) then -- e.g. hello=xxx/hello.ifc
+ flag = k .. "=" .. _get_relative_unix_path_to_cmake(v, outputdir)
+ end
end
end
end