Skip to content

Commit

Permalink
Bugfix: fix iOS CMake architecture #7157 (#7164)
Browse files Browse the repository at this point in the history
* - fix iOS CMake architecture

Signed-off-by: SSE4 <[email protected]>

* Update cmake_flags.py
  • Loading branch information
SSE4 authored Jun 9, 2020
1 parent 27985ef commit e6bfe58
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 7 additions & 3 deletions conans/client/build/cmake_flags.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import platform
from collections import OrderedDict

from conans.client import tools
Expand Down Expand Up @@ -294,9 +295,12 @@ def get_definitions(self):
definitions.update(build_type_definition(self._forced_build_type, build_type,
self._generator, self._output))

if str(os_) == "Macos":
if arch == "x86":
definitions["CMAKE_OSX_ARCHITECTURES"] = "i386"
if tools.is_apple_os(os_):
definitions["CMAKE_OSX_ARCHITECTURES"] = tools.to_apple_arch(arch)
# xcrun is only available on macOS, otherwise it's cross-compiling and it needs to be
# set within CMake toolchain
if platform.system() == "Darwin":
definitions["CMAKE_OSX_SYSROOT"] = tools.XCRun(self._conanfile.settings).sdk_path

definitions.update(self._cmake_cross_build_defines())
definitions.update(self._get_cpp_standard_vars())
Expand Down
5 changes: 3 additions & 2 deletions conans/test/unittests/client/build/cmake_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1307,8 +1307,9 @@ def install_definitions_test(self):
("iOS", "7.0",),
("watchOS", "4.0",),
("tvOS", "11.0",)])
@mock.patch('platform.system', return_value="Macos")
def test_cmake_system_version_osx(self, the_os, os_version, _):
@mock.patch("platform.system", return_value="Darwin")
@mock.patch("conans.client.tools.apple.XCRun.sdk_path", return_value='/opt')
def test_cmake_system_version_osx(self, the_os, os_version, _, __):
settings = Settings.loads(get_default_settings_yml())
settings.os = the_os

Expand Down

0 comments on commit e6bfe58

Please sign in to comment.