diff options
| author | fy <[email protected]> | 2018-12-12 17:17:16 +0800 |
|---|---|---|
| committer | fy <[email protected]> | 2018-12-12 17:17:16 +0800 |
| commit | a8e3c0823bf452378184e126e7ef0f1867800d2a (patch) | |
| tree | bcf2574f1b77698abac541d76ecd5d4907caa774 /xmake/modules/package/tools/cmake.lua | |
| parent | 9c2497e8b3eb08b47323f38ed218702f833073cc (diff) | |
`package.tools.cmake` works with `configs`
Diffstat (limited to 'xmake/modules/package/tools/cmake.lua')
| -rw-r--r-- | xmake/modules/package/tools/cmake.lua | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 2334f449f..efee315be 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -30,11 +30,21 @@ import("lib.detect.find_file") function install(package, configs) os.mkdir("build/install") local oldir = os.cd("build") + local argv = {} + + for name, value in pairs(configs) do + value = tostring(value):trim() + if value ~= "" then + table.insert(argv, value) + end + end + if is_plat("windows") and is_arch("x64") then - os.vrun("cmake -A x64 -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install")) + os.vrunv(format("cmake -A x64 -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install")), argv) else - os.vrun("cmake -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install")) + os.vrunv(format("cmake -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install")), argv) end + if is_host("windows") then local slnfile = assert(find_file("*.sln", os.curdir()), "*.sln file not found!") os.vrun("msbuild \"%s\" -nologo -t:Rebuild -p:Configuration=%s -p:Platform=%s", slnfile, package:debug() and "Debug" or "Release", is_arch("x64") and "x64" or "Win32") |
