From 028ce30a5de36204f7b402ca76efd7a82186ad33 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 5 Dec 2020 00:48:46 +0800 Subject: improve cmake/tools --- xmake/modules/package/tools/cmake.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'xmake/modules/package/tools/cmake.lua') diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 9878a57c8..160568cd1 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -438,7 +438,8 @@ end -- do build for cmake/build function _build_for_cmakebuild(package, configs, opt) - os.vrunv("cmake", {"--build", os.curdir()}, {envs = opt.envs or buildenvs(package)}) + local cmake = assert(find_tool("cmake"), "cmake not found!") + os.vrunv(cmake.program, {"--build", os.curdir()}, {envs = opt.envs or buildenvs(package)}) end -- do install for msvc @@ -512,8 +513,9 @@ end -- do install for cmake/build function _install_for_cmakebuild(package, configs, opt) opt = opt or {} - os.vrunv("cmake", {"--build", os.curdir()}, {envs = opt.envs or buildenvs(package)}) - os.vrunv("cmake", {"--install", os.curdir()}) + local cmake = assert(find_tool("cmake"), "cmake not found!") + os.vrunv(cmake.program, {"--build", os.curdir()}, {envs = opt.envs or buildenvs(package)}) + os.vrunv(cmake.program, {"--install", os.curdir()}) _install_files_for_cmake(package, opt) end @@ -555,7 +557,8 @@ function build(package, configs, opt) table.insert(argv, oldir) -- do configure - os.vrunv("cmake", argv, {envs = opt.envs or buildenvs(package, opt)}) + local cmake = assert(find_tool("cmake"), "cmake not found!") + os.vrunv(cmake.program, argv, {envs = opt.envs or buildenvs(package, opt)}) -- do build local cmake_generator = opt.cmake_generator @@ -613,7 +616,8 @@ function install(package, configs, opt) table.insert(argv, oldir) -- generate build file - os.vrunv("cmake", argv, {envs = opt.envs or buildenvs(package, opt)}) + local cmake = assert(find_tool("cmake"), "cmake not found!") + os.vrunv(cmake.program, argv, {envs = opt.envs or buildenvs(package, opt)}) -- do build and install local cmake_generator = opt.cmake_generator -- cgit v1.3.1