diff options
| -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") |
