From 1ae43ee981c8dc36735b7810b6ba14e1e49b3dae Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 13 Mar 2022 23:07:38 +0800 Subject: improve cmakelist generator --- xmake/plugins/project/cmake/cmakelists.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index 90d0b65a0..6484e09d4 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -548,32 +548,32 @@ function _get_command_string(cmd) local argv = {} for _, v in ipairs(table.join(cmd.program, cmd.argv)) do if path.is_absolute(v) then - v = _get_unix_path(v) + v = _get_unix_path_relative_to_cmake(v) end table.insert(argv, v) end local command = os.args(argv) if opt and opt.curdir then - command = "${CMAKE_COMMAND} -E chdir " .. _get_unix_path(opt.curdir) .. " " .. command + command = "${CMAKE_COMMAND} -E chdir " .. _get_unix_path_relative_to_cmake(opt.curdir) .. " " .. command end return command elseif kind == "cp" then if os.isdir(cmd.srcpath) then return string.format("${CMAKE_COMMAND} -E copy_directory %s %s", - _get_unix_path(cmd.srcpath), _get_unix_path(cmd.dstpath)) + _get_unix_path_relative_to_cmake(cmd.srcpath), _get_unix_path_relative_to_cmake(cmd.dstpath)) else return string.format("${CMAKE_COMMAND} -E copy %s %s", - _get_unix_path(cmd.srcpath), _get_unix_path(cmd.dstpath)) + _get_unix_path_relative_to_cmake(cmd.srcpath), _get_unix_path_relative_to_cmake(cmd.dstpath)) end elseif kind == "rm" then - return string.format("${CMAKE_COMMAND} -E rm -rf %s", _get_unix_path(cmd.filepath)) + return string.format("${CMAKE_COMMAND} -E rm -rf %s", _get_unix_path_relative_to_cmake(cmd.filepath)) elseif kind == "mv" then return string.format("${CMAKE_COMMAND} -E rename %s %s", - _get_unix_path(cmd.srcpath), _get_unix_path(cmd.dstpath)) + _get_unix_path_relative_to_cmake(cmd.srcpath), _get_unix_path_relative_to_cmake(cmd.dstpath)) elseif kind == "cd" then - return string.format("cd %s", _get_unix_path(cmd.dir)) + return string.format("cd %s", _get_unix_path_relative_to_cmake(cmd.dir)) elseif kind == "mkdir" then - return string.format("${CMAKE_COMMAND} -E make_directory %s", _get_unix_path(cmd.dir)) + return string.format("${CMAKE_COMMAND} -E make_directory %s", _get_unix_path_relative_to_cmake(cmd.dir)) elseif kind == "show" then return string.format("echo %s", cmd.showtext) end -- cgit v1.3.1