diff options
| author | RichardYCJ <[email protected]> | 2023-03-11 11:30:24 +0800 |
|---|---|---|
| committer | RichardYCJ <[email protected]> | 2023-03-11 11:30:24 +0800 |
| commit | 6996d90e429ff6013d31ffb98601fa006f07b650 (patch) | |
| tree | 48c087953995d59928a7078dcec32045f3abe948 /xmake/modules | |
| parent | b0eb2717ec85014f1498bb0ffbf6cd1c7cb26ba6 (diff) | |
improve cmake::find_package, use debug flags
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/package/manager/cmake/configurations.lua | 1 | ||||
| -rw-r--r-- | xmake/modules/package/manager/cmake/find_package.lua | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/xmake/modules/package/manager/cmake/configurations.lua b/xmake/modules/package/manager/cmake/configurations.lua index 3cc597a93..626c973d0 100644 --- a/xmake/modules/package/manager/cmake/configurations.lua +++ b/xmake/modules/package/manager/cmake/configurations.lua @@ -29,6 +29,7 @@ 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 9548f9d76..a25cd9e74 100644 --- a/xmake/modules/package/manager/cmake/find_package.lua +++ b/xmake/modules/package/manager/cmake/find_package.lua @@ -107,6 +107,13 @@ 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 + end try {function() return os.vrunv(cmake.program, {workdir}, {curdir = workdir, envs = envs}) end} -- pares defines and includedirs for macosx/linux |
