diff options
| author | Arthur LAURENT <[email protected]> | 2024-02-08 14:48:08 +0100 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2024-02-08 14:51:50 +0100 |
| commit | 93545500fa6f1ac8bb9980d3837ca5b6847b0ebb (patch) | |
| tree | 4834f7f8bcff554633ff006c7eaee782b7f481b9 | |
| parent | b23959e2e56181f021f4f41dd7aaedc3bd8197f3 (diff) | |
fix module compilation for CMake
| -rw-r--r-- | xmake/plugins/project/cmake/cmakelists.lua | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index 723b80b33..30ba57d66 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -68,6 +68,7 @@ end function _escape_path(filepath) if is_host("windows") then filepath = filepath:gsub('\\', '/') + filepath = filepath:gsub(' ', '\\ ') end return filepath end @@ -345,8 +346,8 @@ function _add_target_sources(cmakelists, target, outputdir) local has_cuda = false cmakelists:print("target_sources(%s PRIVATE", target:name()) local sourcebatches = target:sourcebatches() - for _, sourcebatch in table.orderpairs(sourcebatches) do - if _sourcebatch_is_built(sourcebatch) then + for name, sourcebatch in table.orderpairs(sourcebatches) do + if _sourcebatch_is_built(sourcebatch) and not name:startswith("c++.build.modules") then for _, sourcefile in ipairs(sourcebatch.sourcefiles) do cmakelists:print(" " .. _get_relative_unix_path(sourcefile, outputdir)) end @@ -899,6 +900,7 @@ function _get_command_string(cmd, outputdir) table.insert(argv, _translate_flag(v, outputdir)) end local command = _escape_path(cmd.program) .. " " .. os.args(argv) + print(cmd.program, _escape_path(cmd.program)) if opt and opt.curdir then command = "${CMAKE_COMMAND} -E chdir " .. _get_relative_unix_path_to_cmake(opt.curdir, outputdir) .. " " .. command end @@ -1008,7 +1010,7 @@ function _add_target(cmakelists, target, outputdir) _add_target_headeronly(cmakelists, target) _add_target_include_directories(cmakelists, target, outputdir) return - elseif targetkind == 'headeronly' then + elseif targetkind == 'moduleonly' then _add_target_moduleonly(cmakelists, target) else raise("unknown target kind %s", target:kind()) |
