diff options
| author | ruki <[email protected]> | 2024-11-21 00:08:24 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-11-21 00:08:24 +0800 |
| commit | b6a04f8a7bf77f759093921ddd95d1ee0abaa998 (patch) | |
| tree | c11cc692d2b83bf27c3c1323a21df509bf29ab7c | |
| parent | 8155e5a28afdd72454c269338deb99c15677ac89 (diff) | |
fix cmake flags
| -rw-r--r-- | xmake/modules/package/tools/cmake.lua | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 2618246b6..6412eeb71 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -1245,10 +1245,8 @@ function _shrink_cmake_arguments(argv, oldir, opt) if build_type then table.insert(cmake_argv, ("if(CMAKE_BUILD_TYPE STREQUAL \"%s\")"):format(build_type)) end - for _, flag in ipairs(os.argv(v)) do - flag = flag:replace(" ", "\\ ") - table.insert(cmake_argv, ("add_compile_options($<$<COMPILE_LANGUAGE:%s>:%s>)"):format(kind, flag)) - end + local flags = v:replace(" ", "\\ ") + table.insert(cmake_argv, ("add_compile_options($<$<COMPILE_LANGUAGE:%s>:%s>)"):format(kind, flags)) if build_type then table.insert(cmake_argv, "endif()") end @@ -1264,6 +1262,7 @@ function _shrink_cmake_arguments(argv, oldir, opt) end end) if shrink then + print(cmake_argv) local cmakefile = path.join(opt.curdir and opt.curdir or oldir, "CMakeLists.txt") io.insert(cmakefile, 1, table.concat(cmake_argv, "\n")) end |
