diff options
| author | RichardYCJ <[email protected]> | 2023-03-10 22:18:16 +0800 |
|---|---|---|
| committer | RichardYCJ <[email protected]> | 2023-03-10 22:18:16 +0800 |
| commit | 1c254ee6ab33a0701c57b5e9dafa2b1641b3c929 (patch) | |
| tree | 068feb8d7117d8ecd674829043debf23bc79f0db | |
| parent | e22cfe2d6205983623a227be5ca563157beced80 (diff) | |
improve cmake::find_package, add debug flags to configs
| -rw-r--r-- | xmake/modules/package/manager/cmake/configurations.lua | 1 | ||||
| -rw-r--r-- | xmake/modules/package/manager/cmake/find_package.lua | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/xmake/modules/package/manager/cmake/configurations.lua b/xmake/modules/package/manager/cmake/configurations.lua index fdb34907b..f8ba1377a 100644 --- a/xmake/modules/package/manager/cmake/configurations.lua +++ b/xmake/modules/package/manager/cmake/configurations.lua @@ -29,6 +29,7 @@ function main() 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\"}"}, find_name = {description = "Set the name used for ${find_name}_LIBS/_INCLUDE_DIRS in cmake"}, + debug = {description = "Set the CMAKE_BUILD_TYPE to Debug if set to true"}, } end diff --git a/xmake/modules/package/manager/cmake/find_package.lua b/xmake/modules/package/manager/cmake/find_package.lua index 686739e28..a16c8ceeb 100644 --- a/xmake/modules/package/manager/cmake/find_package.lua +++ b/xmake/modules/package/manager/cmake/find_package.lua @@ -101,6 +101,10 @@ function _find_package(cmake, name, opt) -- run cmake local envs = configs.envs or opt.envs + -- decide whether to enable debug build type + if (not envs.CMAKE_BUILD_TYPE and configs.debug) then + envs.CMAKE_BUILD_TYPE = "Debug" + end try {function() return os.vrunv(cmake.program, {workdir}, {curdir = workdir, envs = envs}) end} -- pares defines and includedirs for macosx/linux |
