diff options
| author | ruki <[email protected]> | 2019-02-14 22:51:31 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-02-14 11:09:10 +0800 |
| commit | 2b25d1300333ad47706fbcdcab4665abf6785ff1 (patch) | |
| tree | 5e91e3663ee7bf978d7da170eeefbffce1af0520 /xmake/plugins/project/cmake/cmakelists.lua | |
| parent | ae1d10255b58e88ab9b687c333654cf4eb32e2d3 (diff) | |
support some deprecated api for cmakelists
Diffstat (limited to 'xmake/plugins/project/cmake/cmakelists.lua')
| -rw-r--r-- | xmake/plugins/project/cmake/cmakelists.lua | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index 728277eed..ada9f155b 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -115,6 +115,11 @@ function _add_target_include_directories(cmakelists, target) end cmakelists:print(")") end + -- export config header directory (deprecated) + local configheader = target:configheader() + if configheader then + cmakelists:print("target_include_directories(%s PUBLIC %s)", target:name(), path.directory(configheader)) + end end -- add target compile definitions @@ -211,8 +216,23 @@ function _add_target_link_options(cmakelists, target) end end +-- TODO export target headers (deprecated) +function _export_target_headers(target) + local srcheaders, dstheaders = target:headers() + if srcheaders and dstheaders then + local i = 1 + for _, srcheader in ipairs(srcheaders) do + local dstheader = dstheaders[i] + if dstheader then + os.cp(srcheader, dstheader) + end + i = i + 1 + end + end +end + -- add target -function _add_target(cmakelists, target, targetflags) +function _add_target(cmakelists, target) -- add comment cmakelists:print("# target") @@ -231,6 +251,9 @@ function _add_target(cmakelists, target, targetflags) raise("unknown target kind %s", target:targetkind()) end + -- TODO export target headers (deprecated) + _export_target_headers(target) + -- add target dependencies _add_target_dependencies(cmakelists, target) @@ -267,7 +290,7 @@ function _generate_cmakelists(cmakelists) -- add targets for _, target in pairs(project.targets()) do - _add_target(cmakelists, target, targetflags) + _add_target(cmakelists, target) end end |
