From 552090caad52c0c00013d9286a58f1311e7b29f3 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Fri, 23 Oct 2015 14:21:24 -0200 Subject: Support install_pass in CMake. Fixes #431. --- src/luarocks/build/cmake.lua | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/luarocks/build/cmake.lua b/src/luarocks/build/cmake.lua index 7b16fa51..34f6ada0 100644 --- a/src/luarocks/build/cmake.lua +++ b/src/luarocks/build/cmake.lua @@ -6,6 +6,7 @@ local cmake = {} local fs = require("luarocks.fs") local util = require("luarocks.util") local cfg = require("luarocks.cfg") +local deps = require("luarocks.deps") --- Driver function for the "cmake" build back-end. -- @param rockspec table: the loaded rockspec. @@ -53,13 +54,26 @@ function cmake.run(rockspec) return nil, "Failed cmake." end - if not fs.execute_string(rockspec.variables.CMAKE.." --build build.luarocks --config Release") then - return nil, "Failed building." + local do_build, do_install + if deps.format_is_at_least(rockspec, "3.0") then + do_build = (build.build_pass == nil) and true or build.build_pass + do_install = (build.install_pass == nil) and true or build.install_pass + else + do_build = true + do_install = true end - if not fs.execute_string(rockspec.variables.CMAKE.." --build build.luarocks --target install --config Release") then - return nil, "Failed installing." + if do_build then + if not fs.execute_string(rockspec.variables.CMAKE.." --build build.luarocks --config Release") then + return nil, "Failed building." + end end + if do_install then + if not fs.execute_string(rockspec.variables.CMAKE.." --build build.luarocks --target install --config Release") then + return nil, "Failed installing." + end + end + return true end -- cgit v1.2.3-55-g6feb