Repository: conan-io/conan
Pull request #12486 (2022-11-08 01:17:19)

xcrun settings
Changelog: (Feature | Fix | Bugfix): Describe here your pull request
Docs: https://github.com/conan-io/docs/pull/XXXX

- [ ] Refer to the issue that supports this Pull Request.
- [ ] If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
- [ ] I've read the [Contributing guide](https://github.com/conan-io/conan/blob/develop/.github/CONTRIBUTING.md).
- [ ] I've followed the PEP8 style guides for Python code.
- [ ] I've opened another PR in the Conan docs repo to the ``develop`` branch, documenting this one. 

<sup>**Note:** By default this PR will skip the slower tests and will use a limited set of python versions. Check [here](https://github.com/conan-io/conan/blob/develop/.github/PR_INCREASE_TESTING.md) how to increase the testing level by writing some tags in the current PR body text.</sup>



Patch:
diff --git a/conan/tools/apple/apple.py b/conan/tools/apple/apple.py
index b2efefd48..8bffb654e 100644
--- a/conan/tools/apple/apple.py
+++ b/conan/tools/apple/apple.py
@@ -89,6 +89,7 @@ class XCRun(object):
         settings = conanfile.settings
         if use_settings_target and hasattr(conanfile, "settings_target") and conanfile.settings_target is not None:
             settings = conanfile.settings_target
+        self.settings = settings
 
         if sdk is None and settings:
             sdk = apple_sdk_name(settings)
@@ -266,7 +267,7 @@ def fix_apple_shared_install_name(conanfile):
     if is_apple_os(conanfile) and conanfile.options.get_safe("shared", False):
         substitutions = _fix_dylib_files(conanfile)
 
-        # Only "fix" executables if dylib files were patched, otherwise 
+        # Only "fix" executables if dylib files were patched, otherwise
         # there is nothing to do.
         if substitutions:
             _fix_executables(conanfile, substitutions)
diff --git a/conan/tools/gnu/autotools.py b/conan/tools/gnu/autotools.py
index f857321a9..1992ba20d 100644
--- a/conan/tools/gnu/autotools.py
+++ b/conan/tools/gnu/autotools.py
@@ -55,10 +55,10 @@ class Autotools(object):
         command = join_arguments([make_program, target, str_args, str_extra_args, jobs])
         self._conanfile.run(command)
 
-    def install(self, args=None):
+    def install(self, args=None, target="install"):
         args = args if args is not None else \
             ["DESTDIR={}".format(unix_path(self._conanfile, self._conanfile.package_folder))]
-        self.make(target="install", args=args)
+        self.make(target=target, args=args)
 
     def autoreconf(self, args=None):
         args = args or []
diff --git a/conans/client/migrations_settings.py b/conans/client/migrations_settings.py
index 47713239f..31bd00bf6 100644
--- a/conans/client/migrations_settings.py
+++ b/conans/client/migrations_settings.py
@@ -4029,3 +4029,5 @@ cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]
 """
 
 settings_1_54_0 = settings_1_53_0
+
+settings_1_55_0 = settings_1_54_0


Test patch:
diff --git a/conans/test/unittests/client/toolchain/autotools/autotools_test.py b/conans/test/unittests/client/toolchain/autotools/autotools_test.py
index 36d3b0078..50bcf91a4 100644
--- a/conans/test/unittests/client/toolchain/autotools/autotools_test.py
+++ b/conans/test/unittests/client/toolchain/autotools/autotools_test.py
@@ -34,3 +34,10 @@ def test_configure_arguments():
     ab.make()
     assert "my_make my_make_args -j23" in runner.command_called
 
+    # test install target argument
+
+    ab.install()
+    assert 'my_make install my_make_args DESTDIR=None -j23' in runner.command_called
+
+    ab.install(target="install_other")
+    assert 'my_make install_other my_make_args DESTDIR=None -j23' in runner.command_called
diff --git a/conans/test/unittests/tools/apple/test_apple_tools.py b/conans/test/unittests/tools/apple/test_apple_tools.py
index 6331c1dab..78dd0e93d 100644
--- a/conans/test/unittests/tools/apple/test_apple_tools.py
+++ b/conans/test/unittests/tools/apple/test_apple_tools.py
@@ -2,11 +2,11 @@ import pytest
 
 from conans.test.utils.mocks import ConanFileMock, MockSettings
 from conans.test.utils.test_files import temp_folder
-from conan.tools.apple import is_apple_os, to_apple_arch, fix_apple_shared_install_name
+from conan.tools.apple import is_apple_os, to_apple_arch, fix_apple_shared_install_name, XCRun
 
 def test_tools_apple_is_apple_os():
     conanfile = ConanFileMock()
-    
+
     conanfile.settings = MockSettings({"os": "Macos"})
     assert is_apple_os(conanfile) == True
 
@@ -16,16 +16,17 @@ def test_tools_apple_is_apple_os():
     conanfile.settings = MockSettings({"os": "Windows"})
     assert is_apple_os(conanfile) == False
 
-    
+
 def test_tools_apple_to_apple_arch():
     conanfile = ConanFileMock()
-    
+
     conanfile.settings = MockSettings({"arch": "armv8"})
     assert to_apple_arch(conanfile) == "arm64"
 
     conanfile.settings = MockSettings({"arch": "x86_64"})
     assert to_apple_arch(conanfile) == "x86_64"
 
+
 def test_fix_shared_install_name_no_libraries():
     conanfile = ConanFileMock(
         options="""{"shared": [True, False]}""",
@@ -36,3 +37,14 @@ def test_fix_shared_install_name_no_libraries():
     with pytest.raises(Exception) as e:
         fix_apple_shared_install_name(conanfile)
         assert "not found inside package folder" in str(e.value)
+
+
+def test_xcrun_public_settings():
+    # https://github.com/conan-io/conan/issues/12485
+    conanfile = ConanFileMock()
+    conanfile.settings = MockSettings({"os": "watchOS"})
+
+    xcrun = XCRun(conanfile, use_settings_target=True)
+    settings = xcrun.settings
+
+    assert settings.os == "watchOS"