summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichardYCJ <[email protected]>2023-03-12 12:52:54 +0800
committerRichardYCJ <[email protected]>2023-03-12 12:52:54 +0800
commit03876679ef973dd809e0040066e4f936c27c53db (patch)
tree56cf7a279be45129a126afe5d0a02c93ed8a5d06
parent6996d90e429ff6013d31ffb98601fa006f07b650 (diff)
fix cmake::find_package, use neater debug set
-rw-r--r--xmake/modules/package/manager/cmake/configurations.lua1
-rw-r--r--xmake/modules/package/manager/cmake/find_package.lua9
2 files changed, 3 insertions, 7 deletions
diff --git a/xmake/modules/package/manager/cmake/configurations.lua b/xmake/modules/package/manager/cmake/configurations.lua
index 626c973d0..3cc597a93 100644
--- a/xmake/modules/package/manager/cmake/configurations.lua
+++ b/xmake/modules/package/manager/cmake/configurations.lua
@@ -29,7 +29,6 @@ function main()
moduledirs = {description = "Set the cmake modules directories."},
presets = {description = "Set the preset values, e.g. {Boost_USE_STATIC_LIB = true}"},
envs = {description = "Set the run environments of cmake, e.g. {CMAKE_PREFIX_PATH = \"xxx\"}"},
- debug = {description = "Set the CMAKE_BUILD_TYPE=Debug if set to ture."}
}
end
diff --git a/xmake/modules/package/manager/cmake/find_package.lua b/xmake/modules/package/manager/cmake/find_package.lua
index a25cd9e74..b548fc123 100644
--- a/xmake/modules/package/manager/cmake/find_package.lua
+++ b/xmake/modules/package/manager/cmake/find_package.lua
@@ -107,12 +107,9 @@ function _find_package(cmake, name, opt)
-- run cmake
local envs = configs.envs or opt.envs
- if (configs.debug) then
- if (not envs) then
- envs = {CMAKE_BUILD_TYPE = "Debug"}
- elseif (not envs.CMAKE_BUILD_TYPE) then
- envs.CMAKE_BUILD_TYPE = "Debug"
- end
+ if opt.mode == "debug" then
+ envs = envs or {}
+ envs.CMAKE_BUILD_TYPE = envs.CMAKE_BUILD_TYPE or "Debug"
end
try {function() return os.vrunv(cmake.program, {workdir}, {curdir = workdir, envs = envs}) end}