summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-09-24 23:53:49 +0800
committerruki <[email protected]>2020-09-24 23:53:49 +0800
commit4b906d273d9bfb0b51f5f0d16f3dfa0f4f5676a7 (patch)
treecca8b864031a4ff5a7e2ac64526d96cef74eab8f
parente3659747443021e53a71992710b28c12fb76adc4 (diff)
support CMAKE_GENERATOR
-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()