diff options
| author | ruki <[email protected]> | 2021-12-27 13:44:39 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-12-27 13:44:39 +0800 |
| commit | 50d7d71ee2a8cdf7fedb40ba543372300e64e1c9 (patch) | |
| tree | c6bdb2275329d1966144ce6faeb15a2c6ffc4a8e | |
| parent | 4d38a848881c9795a98ec32c3baa39f612f27a07 (diff) | |
| parent | a64d5808c1c2c8010139216249811545a11d636c (diff) | |
Merge pull request #1946 from Q2h1Cg/cmake-headeronly
add CMakeLists headeronly support
| -rw-r--r-- | xmake/plugins/project/cmake/cmakelists.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index 12bc5306c..7cbffc699 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -133,6 +133,11 @@ function _add_target_shared(cmakelists, target) cmakelists:print("set_target_properties(%s PROPERTIES LIBRARY_OUTPUT_DIRECTORY \"%s\")", target:name(), _get_unix_path(target:targetdir())) end +-- add target: headeronly +function _add_target_headeronly(cmakelists, target) + cmakelists:print("add_library(%s INTERFACE)", target:name()) +end + -- add target dependencies function _add_target_dependencies(cmakelists, target) local deps = target:get("deps") @@ -658,6 +663,10 @@ function _add_target(cmakelists, target) _add_target_static(cmakelists, target) elseif targetkind == "shared" then _add_target_shared(cmakelists, target) + elseif targetkind == 'headeronly' then + _add_target_headeronly(cmakelists, target) + _add_target_include_directories(cmakelists, target) + return else raise("unknown target kind %s", target:kind()) end |
