diff options
| author | ruki <[email protected]> | 2018-12-12 22:34:35 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-12-12 22:34:35 +0800 |
| commit | fd4ca8751a6d64de8088a05e6f0a8ac4e6e48d2d (patch) | |
| tree | 3c34fff0a75faa76058a22150811bbd386fdef16 | |
| parent | bdfab7b2180fd0652c135b735019b43b5dabc6db (diff) | |
| parent | 4c59f260714576e2c23aa068b4a1beae62756fd3 (diff) | |
Merge pull request #286 from fy0/master
`package.tools.cmake` works with `configs`
| -rw-r--r-- | xmake/modules/package/tools/cmake.lua | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 2334f449f..3cf548d0a 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -30,11 +30,26 @@ import("lib.detect.find_file") function install(package, configs) os.mkdir("build/install") local oldir = os.cd("build") + + local argv = { + "-DCMAKE_INSTALL_PREFIX=\"" .. path.absolute("install") .. "\"" + } + if is_plat("windows") and is_arch("x64") then - os.vrun("cmake -A x64 -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install")) - else - os.vrun("cmake -DCMAKE_INSTALL_PREFIX=\"%s\" ..", path.absolute("install")) + table.insert(argv, "-A") + table.insert(argv, "x64") + end + + for name, value in pairs(configs) do + value = tostring(value):trim() + if value ~= "" then + table.insert(argv, value) + end end + + table.insert(argv, '..') + os.vrunv("cmake", argv) + 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") |
