diff options
| author | ruki <[email protected]> | 2023-09-11 22:49:19 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-09-11 22:49:19 +0800 |
| commit | f3db883a0e206b5dbb6cf2f54b65a5f47240e953 (patch) | |
| tree | 87652667f1e19e1747a1cee4bea2a01fc8630366 | |
| parent | e4cd95393db8b15b2419d10ffa6167103b3cbb6f (diff) | |
| parent | 28f26cc7a109b60519728552ff928cee84912edc (diff) | |
Merge pull request #4182 from star-hengxing/cmake_generator
add policy package.cmake_generator.ninja
| -rw-r--r-- | xmake/core/project/policy.lua | 4 | ||||
| -rw-r--r-- | xmake/modules/package/tools/cmake.lua | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/xmake/core/project/policy.lua b/xmake/core/project/policy.lua index db35b091c..96ed1adaf 100644 --- a/xmake/core/project/policy.lua +++ b/xmake/core/project/policy.lua @@ -100,7 +100,9 @@ function policy.policies() ["package.librarydeps.strict_compatibility"] = {description = "Set strict compatibility for package and it's all library dependencies.", type = "boolean"}, -- Automatically passes dependency configuration for inner xmake package -- https://github.com/xmake-io/xmake/issues/3952 - ["package.xmake.pass_depconfs"] = {description = "Automatically passes dependency configuration for inner xmake package", default = true, type = "boolean"} + ["package.xmake.pass_depconfs"] = {description = "Automatically passes dependency configuration for inner xmake package", default = true, type = "boolean"}, + -- will force cmake package use ninja for build + ["package.cmake_generator.ninja"] = {description = "Set cmake package use ninja for build", default = false, type = "boolean"} } policy._POLICIES = policies end diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index c0076a83c..041c240b1 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -24,6 +24,7 @@ import("core.tool.toolchain") import("core.project.config") import("core.tool.linker") import("core.tool.compiler") +import("core.project.project") import("lib.detect.find_file") import("lib.detect.find_tool") import("package.tools.ninja") @@ -987,6 +988,9 @@ function install(package, configs, opt) -- init options opt = opt or {} + if (not opt.cmake_generator) and project.policy("package.cmake_generator.ninja") then + opt.cmake_generator = "Ninja" + end -- enter build directory local buildir = opt.buildir or package:buildir() |
