diff options
| author | ruki <[email protected]> | 2022-04-17 10:30:35 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-04-17 10:30:35 +0800 |
| commit | 6484a1f8941635ae790a620547b23537e33620a0 (patch) | |
| tree | 1a3f9f137f0393324855abb61cca60c2f80c2978 | |
| parent | 73795473b162fc7d84202ed09d81eca7f5945d15 (diff) | |
sort cmakelists
| -rw-r--r-- | xmake/core/project/target.lua | 2 | ||||
| -rw-r--r-- | xmake/plugins/project/cmake/cmakelists.lua | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 78b620165..122082129 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -1659,7 +1659,7 @@ function _instance:sourcekinds() local sourcekinds = self._SOURCEKINDS if not sourcekinds then sourcekinds = {} - for _, sourcebatch in pairs(self:sourcebatches()) do + for _, sourcebatch in table.orderpairs(self:sourcebatches()) do local sourcekind = sourcebatch.sourcekind if sourcekind then table.insert(sourcekinds, sourcekind) diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index b5cbdef13..dba4e0c0e 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -64,7 +64,7 @@ end -- get enabled languages from targets function _get_project_languages(targets) local languages = {} - for _, target in pairs(targets) do + for _, target in table.orderpairs(targets) do for _, sourcekind in ipairs(target:sourcekinds()) do if sourcekind == "cc" then table.insert(languages, "C") elseif sourcekind == "cxx" then table.insert(languages, "CXX") @@ -109,7 +109,7 @@ function _add_project(cmakelists, languages) end local project_name = project.name() if not project_name then - for _, target in pairs(project.targets()) do + for _, target in table.orderpairs(project.targets()) do project_name = target:name() break end @@ -191,7 +191,7 @@ end function _add_target_sources(cmakelists, target) local has_cuda = false cmakelists:print("target_sources(%s PRIVATE", target:name()) - for _, sourcebatch in pairs(target:sourcebatches()) do + for _, sourcebatch in table.orderpairs(target:sourcebatches()) do local sourcekind = sourcebatch.sourcekind if sourcekind == "cc" or sourcekind == "cxx" or sourcekind == "as" or sourcekind == "cu" then for _, sourcefile in ipairs(sourcebatch.sourcefiles) do @@ -681,7 +681,7 @@ end -- add target custom commands function _add_target_custom_commands(cmakelists, target) _add_target_custom_commands_for_target(cmakelists, target, "before") - for _, sourcebatch in pairs(target:sourcebatches()) do + for _, sourcebatch in table.orderpairs(target:sourcebatches()) do local sourcekind = sourcebatch.sourcekind if sourcekind ~= "cc" and sourcekind ~= "cxx" and sourcekind ~= "as" then _add_target_custom_commands_for_objectrules(cmakelists, target, sourcebatch, "before") @@ -793,7 +793,7 @@ function _generate_cmakelists(cmakelists) _add_project(cmakelists, _get_project_languages(project.targets())) -- add targets - for _, target in pairs(project.targets()) do + for _, target in table.orderpairs(project.targets()) do _add_target(cmakelists, target) end end |
