From 4b906d273d9bfb0b51f5f0d16f3dfa0f4f5676a7 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 24 Sep 2020 23:53:49 +0800 Subject: support CMAKE_GENERATOR --- xmake/modules/package/tools/cmake.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 742adcf61..7709eea4f 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -384,6 +384,12 @@ function build(package, configs, opt) -- local argv = {"-DCMAKE_INSTALL_PREFIX=" .. path.absolute("install"), "-DCMAKE_INSTALL_LIBDIR=" .. path.absolute("install/lib")} + -- exists $CMAKE_GENERATOR? use it + local cmake_generator_env = os.getenv("CMAKE_GENERATOR") + if not opt.cmake_generator and cmake_generator_env then + opt.cmake_generator = cmake_generator_env + end + -- pass configurations for name, value in pairs(_get_configs(package, configs, opt)) do value = tostring(value):trim() @@ -440,6 +446,12 @@ function install(package, configs, opt) -- local argv = {"-DCMAKE_INSTALL_PREFIX=" .. path.absolute("install"), "-DCMAKE_INSTALL_LIBDIR=" .. path.absolute("install/lib")} + -- exists $CMAKE_GENERATOR? use it + local cmake_generator_env = os.getenv("CMAKE_GENERATOR") + if not opt.cmake_generator and cmake_generator_env then + opt.cmake_generator = cmake_generator_env + end + -- pass configurations for name, value in pairs(_get_configs(package, configs, opt)) do value = tostring(value):trim() -- cgit v1.3.1