summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/modules/package/tools/cmake.lua12
1 files changed, 12 insertions, 0 deletions
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()