diff options
| author | ruki <[email protected]> | 2021-11-08 21:01:49 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-11-08 21:01:49 +0800 |
| commit | dd91627cc9baf3a1376b617c76358f7ce99ba2cd (patch) | |
| tree | 81320d436b398227f79addc8614b43924f0fdd1f | |
| parent | 1a746efda91e55d75009149a7f92a8db7d08bfe0 (diff) | |
Update cmakelists.lua
| -rw-r--r-- | xmake/plugins/project/cmake/cmakelists.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index 3223f1c9f..12bc5306c 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -162,6 +162,18 @@ function _add_target_sources(cmakelists, target) cmakelists:print(")") end +-- add target precompilied header +function _add_target_precompiled_header(cmakelists, target) + local precompiled_header = target:get("pcheader") or target:get("pcxxheader") + if precompiled_header then + cmakelists:print("target_precompile_headers(%s PRIVATE", target:name()) + cmakelists:print(" $<$<COMPILE_LANGUAGE:%s>:${CMAKE_CURRENT_SOURCE_DIR}/%s>", + target:get("pcxxheader") and "CXX" or "C", + _get_unix_path(precompiled_header)) + cmakelists:print(")") + end +end + -- add target include directories function _add_target_include_directories(cmakelists, target) local includedirs = _get_configs_from_target(target, "includedirs") @@ -656,6 +668,9 @@ function _add_target(cmakelists, target) -- add target dependencies _add_target_dependencies(cmakelists, target) + -- add target precompilied header + _add_target_precompiled_header(cmakelists, target) + -- add target include directories _add_target_include_directories(cmakelists, target) |
