summaryrefslogtreecommitdiff
path: root/xmake/modules/package/tools/cmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-09-12 21:02:59 +0800
committerruki <[email protected]>2022-09-12 21:02:59 +0800
commit104e96b9e2ea5c06208b0c993a7f5c0c943c5d23 (patch)
tree9b3dbd48ecd5a46a5473dd8b7fab01a77da1b12a /xmake/modules/package/tools/cmake.lua
parent34a61e60c4a2f8a6c0f0e03ad37c7fce2eabfc96 (diff)
improve cross-compilation for macosx
Diffstat (limited to 'xmake/modules/package/tools/cmake.lua')
-rw-r--r--xmake/modules/package/tools/cmake.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index d31788a31..a9223ce85 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -366,11 +366,13 @@ function _get_configs_for_appleos(package, configs, opt)
if package:is_arch("x86_64", "i386") then
envs.CMAKE_OSX_SYSROOT = "watchsimulator"
end
- else
+ elseif package:is_plat("iphoneos") then
envs.CMAKE_SYSTEM_NAME = "iOS"
if package:is_arch("x86_64", "i386") then
envs.CMAKE_OSX_SYSROOT = "iphonesimulator"
end
+ elseif package:is_plat("macosx") then
+ envs.CMAKE_SYSTEM_NAME = "Darwin"
end
envs.CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = "BOTH"
envs.CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = "BOTH"
@@ -577,7 +579,9 @@ function _get_configs(package, configs, opt)
_get_configs_for_windows(package, configs, opt)
elseif package:is_plat("android") then
_get_configs_for_android(package, configs, opt)
- elseif package:is_plat("iphoneos", "watchos") then
+ elseif package:is_plat("iphoneos", "watchos") or
+ -- for cross-compilation on macOS, @see https://github.com/xmake-io/xmake/issues/2804
+ (package:is_plat("macosx") and not package:is_arch(os.subarch())) then
_get_configs_for_appleos(package, configs, opt)
elseif package:is_plat("mingw") then
_get_configs_for_mingw(package, configs, opt)