Repository: conan-io/conan
Pull request #12075 (2022-09-09 21:30:21)

define source_folder in test_package when layout()
Changelog: Feature: Define ``source_folder`` in test_package when ``layout()`` is defined
Docs: Omit

This is a test, to see if something would be broken

Close https://github.com/conan-io/conan/issues/12073


Patch:
diff --git a/.gitignore b/.gitignore
index b4fd19089..c30249731 100644
--- a/.gitignore
+++ b/.gitignore
@@ -90,9 +90,10 @@ conan.conf
 #Generated certificate file
 cacert.pem
 
-#linux backup files
+#linux backup and vim files
 *~
-.*.swp
+.*.sw?
+Session.vim
 
 #Pyinstaller generated binaries
 /pyinstaller
diff --git a/conan/tools/_compilers.py b/conan/tools/_compilers.py
index 5a4cc410c..8379b5b4d 100644
--- a/conan/tools/_compilers.py
+++ b/conan/tools/_compilers.py
@@ -57,6 +57,39 @@ def architecture_flag(settings):
     return ""
 
 
+def libcxx_flags(conanfile):
+    libcxx = conanfile.settings.get_safe("compiler.libcxx")
+    if not libcxx:
+        return None, None
+    compiler = conanfile.settings.get_safe("compiler")
+    lib = stdlib11 = None
+    if compiler == "apple-clang":
+        # In apple-clang 2 only values atm are "libc++" and "libstdc++"
+        lib = "-stdlib={}".format(libcxx)
+    elif compiler == "clang" or compiler == "intel-cc":
+        if libcxx == "libc++":
+            lib = "-stdlib=libc++"
+        elif libcxx == "libstdc++" or libcxx == "libstdc++11":
+            lib = "-stdlib=libstdc++"
+        # FIXME, something to do with the other values? Android c++_shared?
+    elif compiler == "sun-cc":
+        lib = {"libCstd": "-library=Cstd",
+               "libstdcxx": "-library=stdcxx4",
+               "libstlport": "-library=stlport4",
+               "libstdc++": "-library=stdcpp"
+               }.get(libcxx)
+    elif compiler == "qcc":
+        lib = "-Y _{}".format(libcxx)
+
+    if compiler in ['clang', 'apple-clang', 'gcc']:
+        if libcxx == "libstdc++":
+            stdlib11 = "_GLIBCXX_USE_CXX11_ABI=0"
+        elif libcxx == "libstdc++11" and conanfile.conf.get("tools.gnu:define_libcxx11_abi",
+                                                            check_type=bool):
+            stdlib11 = "_GLIBCXX_USE_CXX11_ABI=1"
+    return lib, stdlib11
+
+
 def build_type_link_flags(settings):
     """
     returns link flags specific to the build type (Debug, Release, etc.)
@@ -221,7 +254,7 @@ def _cppstd_apple_clang(clang_version, cppstd):
     https://github.com/Kitware/CMake/blob/master/Modules/Compiler/AppleClang-CXX.cmake
     """
 
-    v98 = vgnu98 = v11 = vgnu11 = v14 = vgnu14 = v17 = vgnu17 = v20 = vgnu20 = None
+    v98 = vgnu98 = v11 = vgnu11 = v14 = vgnu14 = v17 = vgnu17 = v20 = vgnu20 = v23 = vgnu23 = None
 
     if Version(clang_version) >= "4.0":
         v98 = "c++98"
@@ -236,24 +269,32 @@ def _cppstd_apple_clang(clang_version, cppstd):
         v14 = "c++1y"
         vgnu14 = "gnu++1y"
 
-    if Version(clang_version) >= "6.1":
-        v17 = "c++1z"
-        vgnu17 = "gnu++1z"
-
+    # Not confirmed that it didn't work before 9.1 but 1z is still valid, so we are ok
+    # Note: cmake allows c++17 since version 10.0
     if Version(clang_version) >= "9.1":
-        # Not confirmed that it didn't work before 9.1 but 1z is still valid, so we are ok
         v17 = "c++17"
         vgnu17 = "gnu++17"
+    elif Version(clang_version) >= "6.1":
+        v17 = "c++1z"
+        vgnu17 = "gnu++1z"
 
-    if Version(clang_version) >= "10.0":
+    if Version(clang_version) >= "13.0":
+        v20 = "c++20"
+        vgnu20 = "gnu++20"
+    elif Version(clang_version) >= "10.0":
         v20 = "c++2a"
         vgnu20 = "gnu++2a"
 
+    if Version(clang_version) >= "13.0":
+        v23 = "c++2b"
+        vgnu23 = "gnu++2b"
+
     flag = {"98": v98, "gnu98": vgnu98,
             "11": v11, "gnu11": vgnu11,
             "14": v14, "gnu14": vgnu14,
             "17": v17, "gnu17": vgnu17,
-            "20": v20, "gnu20": vgnu20}.get(cppstd, None)
+            "20": v20, "gnu20": vgnu20,
+            "23": v23, "gnu23": vgnu23}.get(cppstd, None)
 
     return "-std=%s" % flag if flag else None
 
diff --git a/conan/tools/apple/__init__.py b/conan/tools/apple/__init__.py
index 22f18bb12..2aa3f7f4d 100644
--- a/conan/tools/apple/__init__.py
+++ b/conan/tools/apple/__init__.py
@@ -1,9 +1,8 @@
 # Keep everything private until we review what is really needed and refactor passing "conanfile"
-# from conan.tools.apple.apple import XCRun
 # from conan.tools.apple.apple import apple_dot_clean
 # from conan.tools.apple.apple import apple_sdk_name
 # from conan.tools.apple.apple import apple_deployment_target_flag
-from conan.tools.apple.apple import fix_apple_shared_install_name, is_apple_os, to_apple_arch
+from conan.tools.apple.apple import fix_apple_shared_install_name, is_apple_os, to_apple_arch, XCRun
 from conan.tools.apple.xcodedeps import XcodeDeps
 from conan.tools.apple.xcodebuild import XcodeBuild
 from conan.tools.apple.xcodetoolchain import XcodeToolchain
diff --git a/conan/tools/apple/apple.py b/conan/tools/apple/apple.py
index b796de342..a68b5d355 100644
--- a/conan/tools/apple/apple.py
+++ b/conan/tools/apple/apple.py
@@ -73,17 +73,17 @@ def apple_min_version_flag(conanfile):
 def apple_sdk_path(conanfile):
     sdk_path = conanfile.conf.get("tools.apple:sdk_path")
     if not sdk_path:
-        sdk_path = XCRun(conanfile.settings).sdk_path
+        sdk_path = XCRun(conanfile).sdk_path
     return sdk_path
 
 
 class XCRun(object):
 
-    def __init__(self, settings, sdk=None):
+    def __init__(self, conanfile, sdk=None):
         """sdk=False will skip the flag
            sdk=None will try to adjust it automatically"""
-        if sdk is None and settings:
-            sdk = apple_sdk_name(settings)
+        if sdk is None and conanfile.settings:
+            sdk = apple_sdk_name(conanfile.settings)
         self.sdk = sdk
 
     def _invoke(self, args):
diff --git a/conan/tools/apple/xcodedeps.py b/conan/tools/apple/xcodedeps.py
index 4838df7a5..fb79a0259 100644
--- a/conan/tools/apple/xcodedeps.py
+++ b/conan/tools/apple/xcodedeps.py
@@ -77,9 +77,8 @@ class XcodeDeps(object):
     _dep_xconfig = textwrap.dedent("""\
         // Conan XcodeDeps generated file for {{pkg_name}}::{{comp_name}}
         // Includes all configurations for each dependency
-        {% for dep in deps %}
-        // Includes for {{dep[0]}}::{{dep[1]}} dependency
-        #include "conan_{{dep[0]}}_{{dep[1]}}.xcconfig"
+        {% for include in deps_includes %}
+        #include "{{include}}"
         {% endfor %}
         #include "{{dep_xconfig_filename}}"
 
@@ -160,10 +159,18 @@ class XcodeDeps(object):
             content_multi = load(multi_path)
         else:
             content_multi = self._dep_xconfig
+
+            def _get_includes(components):
+                # if we require the root component dep::dep include conan_dep.xcconfig
+                # for components (dep::component) include conan_dep_component.xcconfig
+                return [f"conan_{_format_name(component[0])}.xcconfig" if component[0] == component[1]
+                        else f"conan_{_format_name(component[0])}_{_format_name(component[1])}.xcconfig"
+                        for component in components]
+
             content_multi = Template(content_multi).render({"pkg_name": pkg_name,
                                                             "comp_name": comp_name,
                                                             "dep_xconfig_filename": dep_xconfig_filename,
-                                                            "deps": reqs})
+                                                            "deps_includes": _get_includes(reqs)})
 
         if dep_xconfig_filename not in content_multi:
             content_multi = content_multi.replace('.xcconfig"',
diff --git a/conan/tools/build/cppstd.py b/conan/tools/build/cppstd.py
index 339a89cc2..cd2296c4b 100644
--- a/conan/tools/build/cppstd.py
+++ b/conan/tools/build/cppstd.py
@@ -116,8 +116,10 @@ def _apple_clang_supported_cppstd(version):
         return ["98", "gnu98", "11", "gnu11", "14", "gnu14"]
     if version < "10.0":
         return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17"]
+    if version < "13.0":
+        return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20"]
 
-    return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20"]
+    return ["98", "gnu98", "11", "gnu11", "14", "gnu14", "17", "gnu17", "20", "gnu20", "23", "gnu23"]
 
 
 def _gcc_supported_cppstd(version):
diff --git a/conan/tools/cmake/presets.py b/conan/tools/cmake/presets.py
index 2b710d190..c58a2337e 100644
--- a/conan/tools/cmake/presets.py
+++ b/conan/tools/cmake/presets.py
@@ -84,6 +84,21 @@ def _configure_preset(conanfile, generator, cache_variables, toolchain_file, mul
         # we don't even have a conanfile with a `layout()` to determine the build folder.
         # If we install a local conanfile: "conan install ." with a layout(), it will be available.
         ret["binaryDir"] = conanfile.build_folder
+
+    def _format_val(val):
+        return f'"{val}"' if type(val) == str and " " in val else f"{val}"
+
+    # https://github.com/conan-io/conan/pull/12034#issuecomment-1253776285
+    cache_variables_info = " ".join([f"-D{var}={_format_val(value)}" for var, value in cache_variables.items()])
+    add_toolchain_cache = f"-DCMAKE_TOOLCHAIN_FILE={toolchain_file} " \
+        if "CMAKE_TOOLCHAIN_FILE" not in cache_variables_info else ""
+
+    conanfile.output.info(f"Preset '{name}' added to CMakePresets.json. Invoke it manually using "
+                          f"'cmake --preset {name}'")
+    conanfile.output.info(f"If your CMake version is not compatible with "
+                          f"CMakePresets (<3.19) call cmake like: 'cmake <path> "
+                          f"-G {_format_val(generator)} {add_toolchain_cache}"
+                          f"{cache_variables_info}'")
     return ret
 
 
diff --git a/conan/tools/cmake/toolchain/blocks.py b/conan/tools/cmake/toolchain/blocks.py
index 52608545e..74b274727 100644
--- a/conan/tools/cmake/toolchain/blocks.py
+++ b/conan/tools/cmake/toolchain/blocks.py
@@ -5,7 +5,7 @@ from collections import OrderedDict
 
 from jinja2 import Template
 
-from conan.tools._compilers import architecture_flag
+from conan.tools._compilers import architecture_flag, libcxx_flags
 from conan.tools.apple.apple import is_apple_os, to_apple_arch
 from conan.tools.build import build_jobs
 from conan.tools.build.cross_building import cross_building
@@ -159,41 +159,13 @@ class GLibCXXBlock(Block):
         string(APPEND CONAN_CXX_FLAGS " {{ set_libcxx }}")
         {% endif %}
         {% if glibcxx %}
-        add_compile_definitions(_GLIBCXX_USE_CXX11_ABI={{ glibcxx }})
+        add_compile_definitions({{ glibcxx }})
         {% endif %}
         """)
 
     def context(self):
-        libcxx = self._conanfile.settings.get_safe("compiler.libcxx")
-        if not libcxx:
-            return None
-        compiler = self._conanfile.settings.get_safe("compiler")
-        lib = glib = None
-        if compiler == "apple-clang":
-            # In apple-clang 2 only values atm are "libc++" and "libstdc++"
-            lib = "-stdlib={}".format(libcxx)
-        elif compiler == "clang" or compiler == "intel-cc":
-            if libcxx == "libc++":
-                lib = "-stdlib=libc++"
-            elif libcxx == "libstdc++" or libcxx == "libstdc++11":
-                lib = "-stdlib=libstdc++"
-            # FIXME, something to do with the other values? Android c++_shared?
-        elif compiler == "sun-cc":
-            lib = {"libCstd": "Cstd",
-                   "libstdcxx": "stdcxx4",
-                   "libstlport": "stlport4",
-                   "libstdc++": "stdcpp"
-                   }.get(libcxx)
-            if lib:
-                lib = "-library={}".format(lib)
-
-        if compiler in ['clang', 'apple-clang', 'gcc']:
-            if libcxx == "libstdc++":
-                glib = "0"
-            elif libcxx == "libstdc++11" and self._conanfile.conf.get("tools.gnu:define_libcxx11_abi",
-                                                                      check_type=bool):
-                glib = "1"
-        return {"set_libcxx": lib, "glibcxx": glib}
+        libcxx, stdlib11 = libcxx_flags(self._conanfile)
+        return {"set_libcxx": libcxx, "glibcxx": stdlib11}
 
 
 class SkipRPath(Block):
@@ -523,8 +495,9 @@ class FindFiles(Block):
         os_ = self._conanfile.settings.get_safe("os")
         is_apple_ = is_apple_os(self._conanfile)
 
-        # Read information from host context
-        host_req = self._conanfile.dependencies.host.values()
+        # Read information from host context, also including test_requires, which are in host
+        # TODO: Add here in 2.0 the "skip": False trait
+        host_req = self._conanfile.dependencies.filter({"build": False}).values()
         host_build_paths_root = []
         host_build_paths_noroot = []
         host_lib_paths = []
diff --git a/conan/tools/cmake/toolchain/toolchain.py b/conan/tools/cmake/toolchain/toolchain.py
index 4227efae4..310648c41 100644
--- a/conan/tools/cmake/toolchain/toolchain.py
+++ b/conan/tools/cmake/toolchain/toolchain.py
@@ -17,6 +17,7 @@ from conan.tools.intel import IntelCC
 from conan.tools.microsoft import VCVars
 from conan.tools.microsoft.visual import vs_ide_version
 from conans.errors import ConanException
+from conans.model.options import PackageOption
 from conans.util.files import save
 
 
@@ -182,6 +183,13 @@ class CMakeToolchain(object):
         for name, value in self.cache_variables.items():
             if isinstance(value, bool):
                 cache_variables[name] = "ON" if value else "OFF"
+            elif isinstance(value, PackageOption):
+                if str(value).lower() in ["true", "false", "none"]:
+                    cache_variables[name] = "ON" if bool(value) else "OFF"
+                elif str(value).isdigit():
+                    cache_variables[name] = int(value)
+                else:
+                    cache_variables[name] = str(value)
             else:
                 cache_variables[name] = value
 
diff --git a/conan/tools/env/environment.py b/conan/tools/env/environment.py
index 4b92aa6ca..18c5de0b7 100644
--- a/conan/tools/env/environment.py
+++ b/conan/tools/env/environment.py
@@ -65,7 +65,7 @@ def environment_wrap_command(env_filenames, env_folder, cmd, subsystem=None,
 
 
 class _EnvValue:
-    def __init__(self, name, value=_EnvVarPlaceHolder, separator=" ", path=False):
+    def __init__(self, name, value=None, separator=" ", path=False):
         self._name = name
         self._values = [] if value is None else value if isinstance(value, list) else [value]
         self._path = path
@@ -192,16 +192,16 @@ class Environment:
         self._values[name] = _EnvValue(name, None)
 
     def append(self, name, value, separator=None):
-        self._values.setdefault(name, _EnvValue(name)).append(value, separator)
+        self._values.setdefault(name, _EnvValue(name, _EnvVarPlaceHolder)).append(value, separator)
 
     def append_path(self, name, value):
-        self._values.setdefault(name, _EnvValue(name, path=True)).append(value)
+        self._values.setdefault(name, _EnvValue(name, _EnvVarPlaceHolder, path=True)).append(value)
 
     def prepend(self, name, value, separator=None):
-        self._values.setdefault(name, _EnvValue(name)).prepend(value, separator)
+        self._values.setdefault(name, _EnvValue(name, _EnvVarPlaceHolder)).prepend(value, separator)
 
     def prepend_path(self, name, value):
-        self._values.setdefault(name, _EnvValue(name, path=True)).prepend(value)
+        self._values.setdefault(name, _EnvValue(name, _EnvVarPlaceHolder, path=True)).prepend(value)
 
     def remove(self, name, value):
         self._values[name].remove(value)
@@ -231,12 +231,12 @@ class Environment:
         return not self.__eq__(other)
 
     def vars(self, conanfile, scope="build"):
-        return EnvVars(conanfile, self, scope)
+        return EnvVars(conanfile, self._values, scope)
 
 
 class EnvVars:
-    def __init__(self, conanfile, env, scope):
-        self._values = env._values  # {var_name: _EnvValue}, just a reference to the Environment
+    def __init__(self, conanfile, values, scope):
+        self._values = values  # {var_name: _EnvValue}, just a reference to the Environment
         self._conanfile = conanfile
         self._scope = scope
         self._subsystem = deduce_subsystem(conanfile, scope)
@@ -277,7 +277,6 @@ class EnvVars:
         filepath, filename = os.path.split(file_location)
         deactivate_file = os.path.join(filepath, "deactivate_{}".format(filename))
         deactivate = textwrap.dedent("""\
-            echo Capturing current environment in {deactivate_file}
             setlocal
             echo @echo off > "{deactivate_file}"
             echo echo Restoring environment >> "{deactivate_file}"
@@ -298,7 +297,6 @@ class EnvVars:
         capture = textwrap.dedent("""\
             @echo off
             {deactivate}
-            echo Configuring environment variables
             """).format(deactivate=deactivate if generate_deactivate else "")
         result = [capture]
         for varname, varvalues in self._values.items():
@@ -312,8 +310,6 @@ class EnvVars:
         filepath, filename = os.path.split(file_location)
         deactivate_file = os.path.join(filepath, "deactivate_{}".format(filename))
         deactivate = textwrap.dedent("""\
-            echo "Capturing current environment in {deactivate_file}"
-
             "echo `"Restoring environment`"" | Out-File -FilePath "{deactivate_file}"
             $vars = (Get-ChildItem env:*).name
             $updated_vars = @({vars})
@@ -337,7 +333,6 @@ class EnvVars:
 
         capture = textwrap.dedent("""\
             {deactivate}
-            echo "Configuring environment variables"
         """).format(deactivate=deactivate if generate_deactivate else "")
         result = [capture]
         for varname, varvalues in self._values.items():
@@ -355,7 +350,6 @@ class EnvVars:
         filepath, filename = os.path.split(file_location)
         deactivate_file = os.path.join(filepath, "deactivate_{}".format(filename))
         deactivate = textwrap.dedent("""\
-           echo Capturing current environment in "{deactivate_file}"
            echo "echo Restoring environment" >> "{deactivate_file}"
            for v in {vars}
            do
@@ -371,7 +365,6 @@ class EnvVars:
            """.format(deactivate_file=deactivate_file, vars=" ".join(self._values.keys())))
         capture = textwrap.dedent("""\
               {deactivate}
-              echo Configuring environment variables
               """).format(deactivate=deactivate if generate_deactivate else "")
         result = [capture]
         for varname, varvalues in self._values.items():
diff --git a/conan/tools/gnu/autotoolstoolchain.py b/conan/tools/gnu/autotoolstoolchain.py
index c747f7903..7269fa2f7 100644
--- a/conan/tools/gnu/autotoolstoolchain.py
+++ b/conan/tools/gnu/autotoolstoolchain.py
@@ -1,6 +1,6 @@
 from conan.tools._check_build_profile import check_using_build_profile
 from conan.tools._compilers import architecture_flag, build_type_flags, cppstd_flag, \
-    build_type_link_flags
+    build_type_link_flags, libcxx_flags
 from conan.tools.apple.apple import apple_min_version_flag, to_apple_arch, \
     apple_sdk_path
 from conan.tools.build.cross_building import cross_building, get_cross_building_settings
@@ -28,7 +28,6 @@ class AutotoolsToolchain:
         self.extra_defines = []
 
         # Defines
-        self.gcc_cxx11_abi = self._get_cxx11_abi_define()
         self.ndebug = None
         build_type = self._conanfile.settings.get_safe("build_type")
         if build_type in ['Release', 'RelWithDebInfo', 'MinSizeRel']:
@@ -40,7 +39,7 @@ class AutotoolsToolchain:
 
         self.cppstd = cppstd_flag(self._conanfile.settings)
         self.arch_flag = architecture_flag(self._conanfile.settings)
-        self.libcxx = self._get_libcxx_flag()
+        self.libcxx, self.gcc_cxx11_abi = libcxx_flags(self._conanfile)
         self.fpic = self._conanfile.options.get_safe("fPIC")
         self.msvc_runtime_flag = self._get_msvc_runtime_flag()
 
@@ -75,49 +74,12 @@ class AutotoolsToolchain:
 
         check_using_build_profile(self._conanfile)
 
-    def _get_cxx11_abi_define(self):
-        # https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
-        # The default is libstdc++11, only specify the contrary '_GLIBCXX_USE_CXX11_ABI=0'
-        settings = self._conanfile.settings
-        libcxx = settings.get_safe("compiler.libcxx")
-        if not libcxx:
-            return
-
-        compiler = settings.get_safe("compiler.base") or settings.get_safe("compiler")
-        if compiler in ['clang', 'apple-clang', 'gcc']:
-            if libcxx == 'libstdc++':
-                return '_GLIBCXX_USE_CXX11_ABI=0'
-            elif libcxx == "libstdc++11" and self._conanfile.conf.get("tools.gnu:define_libcxx11_abi",
-                                                                      check_type=bool):
-                return '_GLIBCXX_USE_CXX11_ABI=1'
-
     def _get_msvc_runtime_flag(self):
         flag = msvc_runtime_flag(self._conanfile)
         if flag:
             flag = "-{}".format(flag)
         return flag
 
-    def _get_libcxx_flag(self):
-        settings = self._conanfile.settings
-        libcxx = settings.get_safe("compiler.libcxx")
-        if not libcxx:
-            return
-
-        compiler = settings.get_safe("compiler.base") or settings.get_safe("compiler")
-
-        if compiler in ['clang', 'apple-clang']:
-            if libcxx in ['libstdc++', 'libstdc++11']:
-                return '-stdlib=libstdc++'
-            elif libcxx == 'libc++':
-                return '-stdlib=libc++'
-        elif compiler == 'sun-cc':
-            return ({"libCstd": "-library=Cstd",
-                     "libstdcxx": "-library=stdcxx4",
-                     "libstlport": "-library=stlport4",
-                     "libstdc++": "-library=stdcpp"}.get(libcxx))
-        elif compiler == "qcc":
-            return "-Y _%s" % str(libcxx)
-
     @staticmethod
     def _filter_list_empty_fields(v):
         return list(filter(bool, v))
diff --git a/conan/tools/gnu/pkgconfigdeps.py b/conan/tools/gnu/pkgconfigdeps.py
index 2eb5a8ff8..38a7737d6 100644
--- a/conan/tools/gnu/pkgconfigdeps.py
+++ b/conan/tools/gnu/pkgconfigdeps.py
@@ -86,7 +86,7 @@ def _get_formatted_dirs(folders, prefix_path_):
 _PCInfo = namedtuple("PCInfo", ['name', 'requires', 'description', 'cpp_info', 'aliases'])
 
 
-class PCContentGenerator:
+class _PCContentGenerator:
 
     template = textwrap.dedent("""\
         {%- macro get_libs(libdirs, cpp_info, gnudeps_flags) -%}
@@ -198,13 +198,13 @@ class PCContentGenerator:
         return template.render(context)
 
 
-class PCGenerator:
+class _PCGenerator:
 
     def __init__(self, conanfile, dep, build_context_suffix=None):
         self._conanfile = conanfile
         self._build_context_suffix = build_context_suffix or {}
         self._dep = dep
-        self._content_generator = PCContentGenerator(self._conanfile, self._dep)
+        self._content_generator = _PCContentGenerator(self._conanfile, self._dep)
 
     def _get_cpp_info_requires_names(self, cpp_info):
         """
@@ -398,7 +398,7 @@ class PkgConfigDeps:
             if dep.is_build_context and dep.ref.name not in self.build_context_activated:
                 continue
 
-            pc_generator = PCGenerator(self._conanfile, dep, build_context_suffix=self.build_context_suffix)
+            pc_generator = _PCGenerator(self._conanfile, dep, build_context_suffix=self.build_context_suffix)
             pc_files.update(pc_generator.pc_files)
         return pc_files
 
diff --git a/conan/tools/meson/toolchain.py b/conan/tools/meson/toolchain.py
index 2daa47d2a..d97116943 100644
--- a/conan/tools/meson/toolchain.py
+++ b/conan/tools/meson/toolchain.py
@@ -4,6 +4,7 @@ import textwrap
 from jinja2 import Template
 
 from conan.tools._check_build_profile import check_using_build_profile
+from conan.tools._compilers import libcxx_flags
 from conan.tools.apple.apple import to_apple_arch, is_apple_os, apple_min_version_flag
 from conan.tools.build.cross_building import cross_building, get_cross_building_settings
 from conan.tools.env import VirtualBuildEnv
@@ -131,6 +132,7 @@ class MesonToolchain(object):
 
         self.preprocessor_definitions = {}
         self.pkg_config_path = self._conanfile.generators_folder
+        self.libcxx, self.gcc_cxx11_abi = libcxx_flags(self._conanfile)
 
         check_using_build_profile(self._conanfile)
 
@@ -313,6 +315,11 @@ class MesonToolchain(object):
         self.objc_link_args.extend(apple_flags + extra_flags["ldflags"])
         self.objcpp_link_args.extend(apple_flags + extra_flags["ldflags"])
 
+        if self.libcxx:
+            self.cpp_args.append(self.libcxx)
+        if self.gcc_cxx11_abi:
+            self.cpp_args.append("-D{}".format(self.gcc_cxx11_abi))
+
         return {
             # https://mesonbuild.com/Machine-files.html#properties
             "properties": {k: to_meson_value(v) for k, v in self.properties.items()},
diff --git a/conan/tools/microsoft/msbuilddeps.py b/conan/tools/microsoft/msbuilddeps.py
index 009395802..52353f433 100644
--- a/conan/tools/microsoft/msbuilddeps.py
+++ b/conan/tools/microsoft/msbuilddeps.py
@@ -11,7 +11,6 @@ from conans.errors import ConanException
 from conans.util.files import load, save
 
 VALID_LIB_EXTENSIONS = (".so", ".lib", ".a", ".dylib", ".bc")
-EXCLUDED_SYMBOLS_PATTERN = re.compile(r"[\.+\-]")
 
 
 class MSBuildDeps(object):
@@ -133,7 +132,7 @@ class MSBuildDeps(object):
 
     @staticmethod
     def _get_valid_xml_format(name):
-        return EXCLUDED_SYMBOLS_PATTERN.sub("_", name)
+        return re.compile(r"[.+]").sub("_", name)
 
     def _vars_props_file(self, dep, name, cpp_info, deps, build):
         """
diff --git a/conan/tools/microsoft/toolchain.py b/conan/tools/microsoft/toolchain.py
index 24c2fede8..2b9c4686b 100644
--- a/conan/tools/microsoft/toolchain.py
+++ b/conan/tools/microsoft/toolchain.py
@@ -36,6 +36,9 @@ class MSBuildToolchain(object):
           </ItemDefinitionGroup>
           <PropertyGroup Label="Configuration">
             <PlatformToolset>{{ toolset }}</PlatformToolset>
+            {% for k, v in properties.items() %}
+            <{{k}}>{{ v }}</{{k}}>
+            {% endfor %}
           </PropertyGroup>
         </Project>
     """)
@@ -51,6 +54,7 @@ class MSBuildToolchain(object):
         self.runtime_library = self._runtime_library(conanfile.settings)
         self.cppstd = conanfile.settings.get_safe("compiler.cppstd")
         self.toolset = self._msvs_toolset(conanfile)
+        self.properties = {}
         check_using_build_profile(self._conanfile)
 
     def _name_condition(self, settings):
@@ -163,7 +167,8 @@ class MSBuildToolchain(object):
             "runtime_library": runtime_library,
             "toolset": toolset,
             "compile_options": compile_options,
-            "parallel": parallel
+            "parallel": parallel,
+            "properties": self.properties,
         }
 
     def _write_config_toolchain(self, config_filename):
diff --git a/conan/tools/microsoft/visual.py b/conan/tools/microsoft/visual.py
index 307efff1e..961e72460 100644
--- a/conan/tools/microsoft/visual.py
+++ b/conan/tools/microsoft/visual.py
@@ -198,6 +198,11 @@ def vcvars_arch(conanfile):
                 'x86_64': 'x86_amd64',
                 'armv7': 'x86_arm',
                 'armv8': 'x86_arm64'}.get(arch_host)
+    elif arch_build == 'armv8':
+        arch = {'x86': 'arm64_x86',
+                'x86_64': 'arm64_x64',
+                'armv7': 'arm64_arm',
+                'armv8': 'arm64'}.get(arch_host)
 
     if not arch:
         raise ConanException('vcvars unsupported architectures %s-%s' % (arch_build, arch_host))
diff --git a/conan/tools/scm/git.py b/conan/tools/scm/git.py
index bdff76981..4a5c8194e 100644
--- a/conan/tools/scm/git.py
+++ b/conan/tools/scm/git.py
@@ -11,24 +11,24 @@ class Git(object):
         self._conanfile = conanfile
         self.folder = folder
 
-    def _run(self, cmd):
+    def run(self, cmd):
         with chdir(self._conanfile, self.folder):
             return check_output_runner("git {}".format(cmd)).strip()
 
     def get_commit(self):
         try:
-            # commit = self._run("rev-parse HEAD") For the whole repo
+            # commit = self.run("rev-parse HEAD") For the whole repo
             # This rev-list knows to capture the last commit for the folder
             # --full-history is needed to not avoid wrong commits:
             # https://github.com/conan-io/conan/issues/10971
             # https://git-scm.com/docs/git-rev-list#Documentation/git-rev-list.txt-Defaultmode
-            commit = self._run('rev-list HEAD -n 1 --full-history -- "."')
+            commit = self.run('rev-list HEAD -n 1 --full-history -- "."')
             return commit
         except Exception as e:
             raise ConanException("Unable to get git commit in '%s': %s" % (self.folder, str(e)))
 
     def get_remote_url(self, remote="origin"):
-        remotes = self._run("remote -v")
+        remotes = self.run("remote -v")
         for r in remotes.splitlines():
             name, url = r.split(maxsplit=1)
             if name == remote:
@@ -41,13 +41,13 @@ class Git(object):
         if not remote:
             return False
         try:
-            branches = self._run("branch -r --contains {}".format(commit))
+            branches = self.run("branch -r --contains {}".format(commit))
             return "{}/".format(remote) in branches
         except Exception as e:
             raise ConanException("Unable to check remote commit in '%s': %s" % (self.folder, str(e)))
 
     def is_dirty(self):
-        status = self._run("status -s").strip()
+        status = self.run("status -s").strip()
         return bool(status)
 
     def get_url_and_commit(self, remote="origin"):
@@ -73,7 +73,7 @@ class Git(object):
         return self.get_repo_root(), commit
 
     def get_repo_root(self):
-        folder = self._run("rev-parse --show-toplevel")
+        folder = self.run("rev-parse --show-toplevel")
         return folder.replace("\\", "/")
 
     def clone(self, url, target="", args=None):
@@ -82,8 +82,8 @@ class Git(object):
             url = url.replace("\\", "/")  # Windows local directory
         mkdir(self.folder)
         self._conanfile.output.info("Cloning git repo")
-        self._run('clone "{}" {} {}'.format(url, " ".join(args), target))
+        self.run('clone "{}" {} {}'.format(url, " ".join(args), target))
 
     def checkout(self, commit):
         self._conanfile.output.info("Checkout: {}".format(commit))
-        self._run('checkout {}'.format(commit))
+        self.run('checkout {}'.format(commit))
diff --git a/conans/client/build/cppstd_flags.py b/conans/client/build/cppstd_flags.py
index c086b3174..0964466e8 100644
--- a/conans/client/build/cppstd_flags.py
+++ b/conans/client/build/cppstd_flags.py
@@ -58,7 +58,7 @@ def cppstd_default(settings):
         else _intel_gcc_cppstd_default
     default = {"gcc": _gcc_cppstd_default(compiler_version),
                "clang": _clang_cppstd_default(compiler_version),
-               "apple-clang": "gnu98",  # Confirmed in apple-clang 9.1 with a simple "auto i=1;"
+               "apple-clang": "gnu98",  # Confirmed in apple-clang 9.1 with a simple "auto i=1;"; 14.0 still the same
                "Visual Studio": _visual_cppstd_default(compiler_version),
                "intel": intel_cppstd_default(compiler_version),
                "mcst-lcc": _mcst_lcc_cppstd_default(compiler_version)}.get(str(compiler), None)
@@ -144,7 +144,7 @@ def _cppstd_apple_clang(clang_version, cppstd):
     https://github.com/Kitware/CMake/blob/master/Modules/Compiler/AppleClang-CXX.cmake
     """
 
-    v98 = vgnu98 = v11 = vgnu11 = v14 = vgnu14 = v17 = vgnu17 = v20 = vgnu20 = None
+    v98 = vgnu98 = v11 = vgnu11 = v14 = vgnu14 = v17 = vgnu17 = v20 = vgnu20 = v23 = vgnu23 = None
 
     if Version(clang_version) >= "4.0":
         v98 = "c++98"
@@ -159,24 +159,32 @@ def _cppstd_apple_clang(clang_version, cppstd):
         v14 = "c++1y"
         vgnu14 = "gnu++1y"
 
-    if Version(clang_version) >= "6.1":
-        v17 = "c++1z"
-        vgnu17 = "gnu++1z"
-
+    # Not confirmed that it didn't work before 9.1 but 1z is still valid, so we are ok
+    # Note: cmake allows c++17 since version 10.0
     if Version(clang_version) >= "9.1":
-        # Not confirmed that it didn't work before 9.1 but 1z is still valid, so we are ok
         v17 = "c++17"
         vgnu17 = "gnu++17"
+    elif Version(clang_version) >= "6.1":
+        v17 = "c++1z"
+        vgnu17 = "gnu++1z"
 
-    if Version(clang_version) >= "10.0":
+    if Version(clang_version) >= "13.0":
+        v20 = "c++20"
+        vgnu20 = "gnu++20"
+    elif Version(clang_version) >= "10.0":
         v20 = "c++2a"
         vgnu20 = "gnu++2a"
 
+    if Version(clang_version) >= "13.0":
+        v23 = "c++2b"
+        vgnu23 = "gnu++2b"
+
     flag = {"98": v98, "gnu98": vgnu98,
             "11": v11, "gnu11": vgnu11,
             "14": v14, "gnu14": vgnu14,
             "17": v17, "gnu17": vgnu17,
-            "20": v20, "gnu20": vgnu20}.get(cppstd, None)
+            "20": v20, "gnu20": vgnu20,
+            "23": v23, "gnu23": vgnu23}.get(cppstd, None)
 
     return "-std=%s" % flag if flag else None
 
diff --git a/conans/client/cmd/build.py b/conans/client/cmd/build.py
index 6cda8eb6c..1a4207bfa 100644
--- a/conans/client/cmd/build.py
+++ b/conans/client/cmd/build.py
@@ -12,7 +12,7 @@ from conans.util.log import logger
 def cmd_build(app, conanfile_path, base_path, source_folder, build_folder, package_folder,
               install_folder, test=False, should_configure=True, should_build=True,
               should_install=True, should_test=True, layout_source_folder=None,
-              layout_build_folder=None):
+              layout_build_folder=None, conf=None):
     """ Call to build() method saved on the conanfile.py
     param conanfile_path: path to a conanfile.py
     """
@@ -29,6 +29,8 @@ def cmd_build(app, conanfile_path, base_path, source_folder, build_folder, packa
                              "requirements and generators from '%s' file"
                              % (CONANFILE, CONANFILE, CONANFILE_TXT))
 
+    if conf:
+        conan_file.conf.compose_conf(conf)
     if test:
         try:
             conan_file.requires.add_ref(test)
diff --git a/conans/client/conf/__init__.py b/conans/client/conf/__init__.py
index 25768c904..7bba496bb 100644
--- a/conans/client/conf/__init__.py
+++ b/conans/client/conf/__init__.py
@@ -40,28 +40,28 @@ _t_default_settings_yml = Template(textwrap.dedent("""
                       "11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4",
                       "13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6", "13.7",
                       "14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", "14.8",
-                      "15.0", "15.1", "15.2", "15.3", "15.4"]
+                      "15.0", "15.1", "15.2", "15.3", "15.4", "15.5", "15.6", "16.0", "16.1"]
             sdk: [None, "iphoneos", "iphonesimulator"]
             sdk_version: [None, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4",
                           "13.0", "13.1", "13.2", "13.4", "13.5", "13.6", "13.7",
-                          "14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "15.0", "15.2", "15.4"]
+                          "14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "15.0", "15.2", "15.4", "15.5", "16.0", "16.1"]
         watchOS:
             version: ["4.0", "4.1", "4.2", "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2",
-                      "7.0", "7.1", "7.2", "7.3", "7.4", "7.5", "7.6", "8.0", "8.1", "8.3", "8.4", "8.5"]
+                      "7.0", "7.1", "7.2", "7.3", "7.4", "7.5", "7.6", "8.0", "8.1", "8.3", "8.4", "8.5", "8.6", "8.7", "9.0", "9.1"]
             sdk: [None, "watchos", "watchsimulator"]
             sdk_version: [None, "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2",
-                          "7.0", "7.1", "7.2", "7.4", "8.0", "8.0.1", "8.3", "8.5"]
+                          "7.0", "7.1", "7.2", "7.4", "8.0", "8.0.1", "8.3", "8.5", "9.0", "9.1"]
         tvOS:
             version: ["11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4",
                       "13.0", "13.2", "13.3", "13.4", "14.0", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7",
-                      "15.0", "15.1", "15.2", "15.3", "15.4"]
+                      "15.0", "15.1", "15.2", "15.3", "15.4", "15.5", "15.6", "16.0", "16.1"]
             sdk: [None, "appletvos", "appletvsimulator"]
             sdk_version: [None, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4",
-                          "13.0", "13.1", "13.2", "13.4", "14.0", "14.2", "14.3", "14.5", "15.0", "15.2", "15.4"]
+                          "13.0", "13.1", "13.2", "13.4", "14.0", "14.2", "14.3", "14.5", "15.0", "15.2", "15.4", "16.0", "16.1"]
         Macos:
             version: [None, "10.6", "10.7", "10.8", "10.9", "10.10", "10.11", "10.12", "10.13", "10.14", "10.15", "11.0", "12.0", "13.0"]
             sdk: [None, "macosx"]
-            sdk_version: [None, "10.13", "10.14", "10.15", "11.0", "11.1", "11.3", "12.0", "12.1", "12.3"]
+            sdk_version: [None, "10.13", "10.14", "10.15", "11.0", "11.1", "11.3", "12.0", "12.1", "12.3", "13.0"]
             subsystem:
                 None:
                 catalyst:
@@ -124,9 +124,9 @@ _t_default_settings_yml = Template(textwrap.dedent("""
             runtime: [None, MD, MT, MTd, MDd, static, dynamic]
             runtime_type: [None, Debug, Release]
         apple-clang: &apple_clang
-            version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1", "10.0", "11.0", "12.0", "13", "13.0", "13.1"]
+            version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1", "10.0", "11.0", "12.0", "13", "13.0", "13.1", "14", "14.0"]
             libcxx: [libstdc++, libc++]
-            cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20]
+            cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]
         intel:
             version: ["11", "12", "13", "14", "15", "16", "17", "18", "19", "19.1"]
             update: [None, ANY]
diff --git a/conans/client/manager.py b/conans/client/manager.py
index f27fba832..ae53663c7 100644
--- a/conans/client/manager.py
+++ b/conans/client/manager.py
@@ -83,6 +83,7 @@ def deps_install(app, ref_or_path, install_folder, base_folder, graph_info, remo
         conanfile.folders.set_base_install(install_folder)
         conanfile.folders.set_base_imports(install_folder)
         conanfile.folders.set_base_generators(base_folder)
+        conanfile.folders.set_base_source(base_folder)
 
     if hasattr(conanfile, "layout") and test:
         install_folder = conanfile.generators_folder
@@ -146,4 +147,4 @@ def deps_install(app, ref_or_path, install_folder, base_folder, graph_info, remo
             if hasattr(deploy_conanfile, "deploy") and callable(deploy_conanfile.deploy):
                 run_deploy(deploy_conanfile, install_folder)
 
-    return install_folder
+    return install_folder, conanfile
diff --git a/conans/client/migrations_settings.py b/conans/client/migrations_settings.py
index 3fb8f3df5..129714c2a 100644
--- a/conans/client/migrations_settings.py
+++ b/conans/client/migrations_settings.py
@@ -3874,4 +3874,155 @@ build_type: [None, Debug, Release, RelWithDebInfo, MinSizeRel]
 cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]  # Deprecated, use compiler.cppstd
 """
 
-settings_1_53_0 = settings_1_52_0
+settings_1_53_0 = """
+# Only for cross building, 'os_build/arch_build' is the system that runs Conan
+os_build: [Windows, WindowsStore, Linux, Macos, FreeBSD, SunOS, AIX, VxWorks]
+arch_build: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7]
+
+# Only for building cross compilation tools, 'os_target/arch_target' is the system for
+# which the tools generate code
+os_target: [Windows, Linux, Macos, Android, iOS, watchOS, tvOS, FreeBSD, SunOS, AIX, Arduino, Neutrino]
+arch_target: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, asm.js, wasm, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7, xtensalx6, xtensalx106, xtensalx7]
+
+# Rest of the settings are "host" settings:
+# - For native building/cross building: Where the library/program will run.
+# - For building cross compilation tools: Where the cross compiler will run.
+os:
+    Windows:
+        subsystem: [None, cygwin, msys, msys2, wsl]
+    WindowsStore:
+        version: ["8.1", "10.0"]
+    WindowsCE:
+        platform: ANY
+        version: ["5.0", "6.0", "7.0", "8.0"]
+    Linux:
+    iOS:
+        version: &ios_version
+                 ["7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3",
+                  "11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4",
+                  "13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6", "13.7",
+                  "14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", "14.8",
+                  "15.0", "15.1", "15.2", "15.3", "15.4", "15.5", "15.6", "16.0", "16.1"]
+        sdk: [None, "iphoneos", "iphonesimulator"]
+        sdk_version: [None, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4",
+                      "13.0", "13.1", "13.2", "13.4", "13.5", "13.6", "13.7",
+                      "14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "15.0", "15.2", "15.4", "15.5", "16.0", "16.1"]
+    watchOS:
+        version: ["4.0", "4.1", "4.2", "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2",
+                  "7.0", "7.1", "7.2", "7.3", "7.4", "7.5", "7.6", "8.0", "8.1", "8.3", "8.4", "8.5", "8.6", "8.7", "9.0", "9.1"]
+        sdk: [None, "watchos", "watchsimulator"]
+        sdk_version: [None, "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2",
+                      "7.0", "7.1", "7.2", "7.4", "8.0", "8.0.1", "8.3", "8.5", "9.0", "9.1"]
+    tvOS:
+        version: ["11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4",
+                  "13.0", "13.2", "13.3", "13.4", "14.0", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7",
+                  "15.0", "15.1", "15.2", "15.3", "15.4", "15.5", "15.6", "16.0", "16.1"]
+        sdk: [None, "appletvos", "appletvsimulator"]
+        sdk_version: [None, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4",
+                      "13.0", "13.1", "13.2", "13.4", "14.0", "14.2", "14.3", "14.5", "15.0", "15.2", "15.4", "16.0", "16.1"]
+    Macos:
+        version: [None, "10.6", "10.7", "10.8", "10.9", "10.10", "10.11", "10.12", "10.13", "10.14", "10.15", "11.0", "12.0", "13.0"]
+        sdk: [None, "macosx"]
+        sdk_version: [None, "10.13", "10.14", "10.15", "11.0", "11.1", "11.3", "12.0", "12.1", "12.3", "13.0"]
+        subsystem:
+            None:
+            catalyst:
+                ios_version: *ios_version
+    Android:
+        api_level: ANY
+    FreeBSD:
+    SunOS:
+    AIX:
+    Arduino:
+        board: ANY
+    Emscripten:
+    Neutrino:
+        version: ["6.4", "6.5", "6.6", "7.0", "7.1"]
+    baremetal:
+    VxWorks:
+        version: ["7"]
+arch: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv4, armv4i, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, asm.js, wasm, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7, xtensalx6, xtensalx106, xtensalx7]
+compiler:
+    sun-cc:
+        version: ["5.10", "5.11", "5.12", "5.13", "5.14", "5.15"]
+        threads: [None, posix]
+        libcxx: [libCstd, libstdcxx, libstlport, libstdc++]
+    gcc: &gcc
+        version: ["4.1", "4.4", "4.5", "4.6", "4.7", "4.8", "4.9",
+                  "5", "5.1", "5.2", "5.3", "5.4", "5.5",
+                  "6", "6.1", "6.2", "6.3", "6.4", "6.5",
+                  "7", "7.1", "7.2", "7.3", "7.4", "7.5",
+                  "8", "8.1", "8.2", "8.3", "8.4",
+                  "9", "9.1", "9.2", "9.3", "9.4",
+                  "10", "10.1", "10.2", "10.3",
+                  "11", "11.1", "11.2",
+                  "12"]
+        libcxx: [libstdc++, libstdc++11]
+        threads: [None, posix, win32]  # Windows MinGW
+        exception: [None, dwarf2, sjlj, seh]  # Windows MinGW
+        cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]
+    Visual Studio: &visual_studio
+        runtime: [MD, MT, MTd, MDd]
+        version: ["8", "9", "10", "11", "12", "14", "15", "16", "17"]
+        toolset: [None, v90, v100, v110, v110_xp, v120, v120_xp,
+                  v140, v140_xp, v140_clang_c2, LLVM-vs2012, LLVM-vs2012_xp,
+                  LLVM-vs2013, LLVM-vs2013_xp, LLVM-vs2014, LLVM-vs2014_xp,
+                  LLVM-vs2017, LLVM-vs2017_xp, v141, v141_xp, v141_clang_c2, v142,
+                  llvm, ClangCL, v143]
+        cppstd: [None, 14, 17, 20, 23]
+    msvc:
+        version: [170, 180, 190, 191, 192, 193]
+        update: [None, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+        runtime: [static, dynamic]
+        runtime_type: [Debug, Release]
+        cppstd: [98, 14, 17, 20, 23]
+        toolset: [None, v110_xp, v120_xp, v140_xp, v141_xp]
+    clang:
+        version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0",
+                  "5.0", "6.0", "7.0", "7.1",
+                  "8", "9", "10", "11", "12", "13", "14", "15", "16"]
+        libcxx: [None, libstdc++, libstdc++11, libc++, c++_shared, c++_static]
+        cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]
+        runtime: [None, MD, MT, MTd, MDd, static, dynamic]
+        runtime_type: [None, Debug, Release]
+    apple-clang: &apple_clang
+        version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1", "10.0", "11.0", "12.0", "13", "13.0", "13.1", "14", "14.0"]
+        libcxx: [libstdc++, libc++]
+        cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]
+    intel:
+        version: ["11", "12", "13", "14", "15", "16", "17", "18", "19", "19.1"]
+        update: [None, ANY]
+        base:
+            gcc:
+                <<: *gcc
+                threads: [None]
+                exception: [None]
+            Visual Studio:
+                <<: *visual_studio
+            apple-clang:
+                <<: *apple_clang
+    intel-cc:
+        version: ["2021.1", "2021.2", "2021.3"]
+        update: [None, ANY]
+        mode: ["icx", "classic", "dpcpp"]
+        libcxx: [None, libstdc++, libstdc++11, libc++]
+        cppstd: [None, 98, gnu98, 03, gnu03, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]
+        runtime: [None, static, dynamic]
+        runtime_type: [None, Debug, Release]
+    qcc:
+        version: ["4.4", "5.4", "8.3"]
+        libcxx: [cxx, gpp, cpp, cpp-ne, accp, acpp-ne, ecpp, ecpp-ne]
+        cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17]
+    mcst-lcc:
+        version: ["1.19", "1.20", "1.21", "1.22", "1.23", "1.24", "1.25"]
+        base:
+            gcc:
+                <<: *gcc
+                threads: [None]
+                exceptions: [None]
+
+build_type: [None, Debug, Release, RelWithDebInfo, MinSizeRel]
+
+
+cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23]  # Deprecated, use compiler.cppstd
+"""
diff --git a/conans/client/tools/win.py b/conans/client/tools/win.py
index 618cd8a84..fc51b1a20 100644
--- a/conans/client/tools/win.py
+++ b/conans/client/tools/win.py
@@ -442,6 +442,11 @@ def vcvars_command(conanfile=None, arch=None, compiler_version=None, force=False
                        'x86_64': 'x86_amd64',
                        'armv7': 'x86_arm',
                        'armv8': 'x86_arm64'}.get(arch_setting)
+    elif arch_build == 'armv8':
+        vcvars_arch = {'x86': 'arm64_x86',
+                       'x86_64': 'arm64_x64',
+                       'armv7': 'arm64_arm',
+                       'armv8': 'arm64'}.get(arch_setting)
 
     if not vcvars_arch:
         raise ConanException('unsupported architecture %s' % arch_setting)
diff --git a/conans/model/conf.py b/conans/model/conf.py
index 968bcd87b..4df28790e 100644
--- a/conans/model/conf.py
+++ b/conans/model/conf.py
@@ -6,7 +6,7 @@ import six
 from conans.errors import ConanException
 
 BUILT_IN_CONFS = {
-    "core:required_conan_version": "Raise if current version does not match the defined range.",
+    "core:required_conan_version": "Raise if current version does not match the defined range",
     "core.package_id:msvc_visual_incompatible": "Allows opting-out the fallback from the new msvc compiler to the Visual Studio compiler existing binaries",
     "core:default_profile": "Defines the default host profile ('default' by default)",
     "core:default_build_profile": "Defines the default build profile (None by default)",
@@ -46,14 +46,24 @@ BUILT_IN_CONFS = {
     "tools.apple:enable_bitcode": "(boolean) Enable/Disable Bitcode Apple Clang flags",
     "tools.apple:enable_arc": "(boolean) Enable/Disable ARC Apple Clang flags",
     "tools.apple:enable_visibility": "(boolean) Enable/Disable Visibility Apple Clang flags",
-    # Flags configuration
     "tools.build:cxxflags": "List of extra CXX flags used by different toolchains like CMakeToolchain, AutotoolsToolchain and MesonToolchain",
     "tools.build:cflags": "List of extra C flags used by different toolchains like CMakeToolchain, AutotoolsToolchain and MesonToolchain",
     "tools.build:defines": "List of extra definition flags used by different toolchains like CMakeToolchain and AutotoolsToolchain",
     "tools.build:sharedlinkflags": "List of extra flags used by CMakeToolchain for CMAKE_SHARED_LINKER_FLAGS_INIT variable",
     "tools.build:exelinkflags": "List of extra flags used by CMakeToolchain for CMAKE_EXE_LINKER_FLAGS_INIT variable",
+    "tools.microsoft.bash:subsystem": "Set subsystem to use for Windows. Possible values: 'msys2', 'msys', 'cygwin', 'wsl' and 'sfu'",
+    "tools.microsoft.bash:path": "Path to the shell executable. Default: 'bash'",
+    "tools.apple:sdk_path": "Path for the sdk location. This value will be passed as SDKROOT or -isysroot depending on the generator used",
+    "tools.cmake.cmaketoolchain:toolset_arch": "Will add the ',host=xxx' specifier in the 'CMAKE_GENERATOR_TOOLSET' variable of 'conan_toolchain.cmake' file",
+    "tools.gnu:pkg_config": "Define the 'pkg_config' executable name or full path",
+    "tools.env.virtualenv:powershell": "Opt-in to generate Powershell '.ps1' scripts instead of '.bat'",
+    "tools.meson.mesontoolchain:backend": "Set the Meson backend. Possible values: 'ninja', 'vs', 'vs2010', 'vs2015', 'vs2017', 'vs2019', 'xcode'",
+    "tools.files.download:download_cache": "Location for the download cache",
+    "tools.build.cross_building:can_run": "Set the return value for the 'conan.tools.build.can_run()' tool",
 }
 
+BUILT_IN_CONFS = {key: value for key, value in sorted(BUILT_IN_CONFS.items())}
+
 
 def _is_profile_module(module_name):
     # These are the modules that are propagated to profiles and user recipes
diff --git a/conans/model/options.py b/conans/model/options.py
index 642c4afe2..8c2702380 100644
--- a/conans/model/options.py
+++ b/conans/model/options.py
@@ -231,6 +231,12 @@ class OptionsValues(object):
             return None
         return getattr(self._package_values, attr)
 
+    def rm_safe(self, attr):
+        try:
+            delattr(self._package_values, attr)
+        except ConanException:
+            pass
+
     def __getitem__(self, item):
         return self._reqs_options.setdefault(item, PackageOptionValues())
 
@@ -425,6 +431,12 @@ class PackageOptions(object):
     def get_safe(self, field, default=None):
         return self._data.get(field, default)
 
+    def rm_safe(self, field):
+        try:
+            delattr(self, field)
+        except ConanException:
+            pass
+
     def validate(self):
         for child in self._data.values():
             child.validate()
@@ -584,6 +596,9 @@ class Options(object):
         except ConanException:
             pass
 
+    def rm_safe(self, field):
+        self._package_options.rm_safe(field)
+
     @property
     def values(self):
         result = OptionsValues()
diff --git a/conans/model/settings.py b/conans/model/settings.py
index 8a7e697aa..096483ed3 100644
--- a/conans/model/settings.py
+++ b/conans/model/settings.py
@@ -213,6 +213,19 @@ class Settings(object):
             return str(tmp)
         return default
 
+    def rm_safe(self, name):
+        try:
+            tmp = self
+            attr_ = name
+            if "." in name:
+                fields = name.split(".")
+                attr_ = fields.pop()
+                for prop in fields:
+                    tmp = getattr(tmp, prop)
+            delattr(tmp, attr_)
+        except ConanException:
+            pass
+
     def copy(self):
         """ deepcopy, recursive
         """
diff --git a/conans/requirements.txt b/conans/requirements.txt
index e433e5cf0..6afa64a16 100644
--- a/conans/requirements.txt
+++ b/conans/requirements.txt
@@ -6,7 +6,7 @@ patch-ng>=1.17.4, <1.18
 fasteners>=0.14.1
 six>=1.10.0,<=1.16.0
 node-semver==0.6.1
-distro>=1.0.2, <=1.6.0; sys_platform == 'linux' or sys_platform == 'linux2'
+distro>=1.0.2, <=1.7.0; sys_platform == 'linux' or sys_platform == 'linux2'
 pygments>=2.0, <3.0
 tqdm>=4.28.1, <5
 Jinja2>=2.9, <3.0.0;python_version<='2.7'


Test patch:
diff --git a/conans/client/cmd/test.py b/conans/client/cmd/test.py
index 4c2f580dd..996ff39b1 100644
--- a/conans/client/cmd/test.py
+++ b/conans/client/cmd/test.py
@@ -32,7 +32,7 @@ def install_build_and_test(app, conanfile_abs_path, reference, graph_info,
     if build_modes is None:
         build_modes = ["never"]
     try:
-        install_folder = deps_install(app=app,
+        install_folder, conanfile = deps_install(app=app,
                                       create_reference=reference,
                                       ref_or_path=conanfile_abs_path,
                                       install_folder=test_build_folder,
@@ -53,7 +53,7 @@ def install_build_and_test(app, conanfile_abs_path, reference, graph_info,
         cmd_build(app, conanfile_abs_path, test_build_folder,
                   source_folder=base_folder, build_folder=test_build_folder,
                   package_folder=os.path.join(test_build_folder, "package"),
-                  install_folder=install_folder, test=reference)
+                  install_folder=install_folder, test=reference, conf=conanfile.conf)
     finally:
         if delete_after_build:
             # Required for windows where deleting the cwd is not possible.
diff --git a/conans/test/functional/toolchains/apple/test_xcodedeps_components.py b/conans/test/functional/toolchains/apple/test_xcodedeps_components.py
index 2a50ab1e0..978b3e40d 100644
--- a/conans/test/functional/toolchains/apple/test_xcodedeps_components.py
+++ b/conans/test/functional/toolchains/apple/test_xcodedeps_components.py
@@ -105,10 +105,10 @@ def test_xcodedeps_components():
         self.cpp_info.components["core"].includedirs.append("include")
         self.cpp_info.components["core"].libdirs.append("lib")
 
-        self.cpp_info.components["client"].libs = ["client"]
-        self.cpp_info.components["client"].includedirs.append("include")
-        self.cpp_info.components["client"].libdirs.append("lib")
-        self.cpp_info.components["client"].requires.extend(["core", "tcp::tcp"])
+        self.cpp_info.components["client-test"].libs = ["client"]
+        self.cpp_info.components["client-test"].includedirs.append("include")
+        self.cpp_info.components["client-test"].libdirs.append("lib")
+        self.cpp_info.components["client-test"].requires.extend(["core", "tcp::tcp"])
 
         self.cpp_info.components["server"].libs = ["server"]
         self.cpp_info.components["server"].includedirs.append("include")
@@ -136,7 +136,7 @@ def test_xcodedeps_components():
         self.cpp_info.libs = ["chat"]
         self.cpp_info.includedirs.append("include")
         self.cpp_info.libdirs.append("lib")
-        self.cpp_info.requires.append("network::client")
+        self.cpp_info.requires.append("network::client-test")
     """
 
     cmakelists_chat = textwrap.dedent("""
@@ -146,7 +146,7 @@ def test_xcodedeps_components():
         add_library(chat src/chat.cpp include/chat.h)
         target_include_directories(chat PUBLIC include)
         set_target_properties(chat PROPERTIES PUBLIC_HEADER "include/chat.h")
-        target_link_libraries(chat network::client)
+        target_link_libraries(chat network::client-test)
         install(TARGETS chat)
         """)
 
@@ -184,7 +184,7 @@ def test_xcodedeps_components():
     client.run("install chat/1.0@ -g XcodeDeps --install-folder=conan -s build_type=Debug "
                "--build=missing")
     chat_xcconfig = client.load(os.path.join("conan", "conan_chat_chat.xcconfig"))
-    assert '#include "conan_network_client.xcconfig"' in chat_xcconfig
+    assert '#include "conan_network_client_test.xcconfig"' in chat_xcconfig
     assert '#include "conan_network_server.xcconfig"' not in chat_xcconfig
     assert '#include "conan_network_network.xcconfig"' not in chat_xcconfig
     host_arch = client.get_default_host_profile().settings['arch']
@@ -204,6 +204,78 @@ def test_xcodedeps_components():
     assert "chat/1.0: Hello World Release!" in client.out
 
 
+@pytest.mark.skipif(platform.system() != "Darwin", reason="Only for MacOS")
+@pytest.mark.tool_cmake
+def test_cpp_info_require_whole_package():
+    """
+    https://github.com/conan-io/conan/issues/12089
+
+    liba has two components liba::cmp1 liba::cmp2
+
+    libb has not components and requires liba::liba so should generate the same info as
+    if it was requiring liba::cmp1 and liba::cmp2
+
+    libc has components and one component requires liba::liba so should generate the same info as if
+    it was requiring liba::cmp1 and liba::cmp2
+    """
+    client = TestClient(path_with_spaces=False)
+
+    liba = textwrap.dedent("""
+        import os
+        from conan import ConanFile
+        class LibConan(ConanFile):
+            settings = "os", "compiler", "build_type", "arch"
+            name = "liba"
+            version = "1.0"
+            def package_info(self):
+                self.cpp_info.components["cmp1"].includedirs.append("cmp1")
+                self.cpp_info.components["cmp2"].includedirs.append("cmp2")
+        """)
+
+    libb = textwrap.dedent("""
+        import os
+        from conan import ConanFile
+        class LibConan(ConanFile):
+            settings = "os", "compiler", "build_type", "arch"
+            name = "libb"
+            version = "1.0"
+            requires = "liba/1.0"
+            def package_info(self):
+                self.cpp_info.requires = ["liba::liba"]
+        """)
+
+    libc = textwrap.dedent("""
+        import os
+        from conan import ConanFile
+        class LibConan(ConanFile):
+            settings = "os", "compiler", "build_type", "arch"
+            name = "libc"
+            version = "1.0"
+            requires = "liba/1.0"
+            def package_info(self):
+                self.cpp_info.components["cmp1"].includedirs.append("cmp1")
+                self.cpp_info.components["cmp2"].includedirs.append("cmp2")
+                self.cpp_info.components["cmp1"].requires = ["liba::liba"]
+        """)
+
+    client.save({"liba.py": liba, "libb.py": libb, "libc.py": libc})
+
+    client.run("create liba.py")
+    client.run("create libb.py")
+    client.run("create libc.py")
+    client.run("install libb/1.0@ -g XcodeDeps --install-folder=libb")
+
+    libb_xcconfig = client.load(os.path.join("libb", "conan_libb_libb.xcconfig"))
+    assert '#include "conan_liba.xcconfig"' in libb_xcconfig
+    assert '#include "conan_liba_liba.xcconfig"' not in libb_xcconfig
+
+    client.run("install libc/1.0@ -g XcodeDeps --install-folder=libc")
+
+    libc_comp1_xcconfig = client.load(os.path.join("libc", "conan_libc_cmp1.xcconfig"))
+    assert '#include "conan_liba.xcconfig"' in libc_comp1_xcconfig
+    assert '#include "conan_liba_liba.xcconfig"' not in libc_comp1_xcconfig
+
+
 @pytest.mark.skipif(platform.system() != "Darwin", reason="Only for MacOS")
 @pytest.mark.tool_cmake
 def test_xcodedeps_test_require():
diff --git a/conans/test/functional/toolchains/meson/test_meson_and_gnu_deps_flags.py b/conans/test/functional/toolchains/meson/test_meson_and_gnu_deps_flags.py
index 8c3d0c018..924f59f0a 100644
--- a/conans/test/functional/toolchains/meson/test_meson_and_gnu_deps_flags.py
+++ b/conans/test/functional/toolchains/meson/test_meson_and_gnu_deps_flags.py
@@ -142,5 +142,7 @@ class TestMesonToolchainAndGnuFlags(TestMesonBase):
                "".format(folder=client.current_folder.replace("\\", "/")) in meson_log
         # Flags/Defines from deps and consumer are appearing in meson-log.txt as part
         # of the command-line
-        assert '%s -DVAR="VALUE" -DVAR2="VALUE2" %s' % (flags, deps_flags) in meson_log
+        assert flags in meson_log
+        assert '-DVAR="VALUE" -DVAR2="VALUE2"' in meson_log
+        assert deps_flags in meson_log
         assert '-DDEF3=simple_string -DDEF1=one_string -DDEF2=other_string' in meson_log
diff --git a/conans/test/functional/toolchains/test_msbuild_toolchain.py b/conans/test/functional/toolchains/test_msbuild_toolchain.py
index b6869796d..f3d557b72 100644
--- a/conans/test/functional/toolchains/test_msbuild_toolchain.py
+++ b/conans/test/functional/toolchains/test_msbuild_toolchain.py
@@ -31,11 +31,13 @@ def test_toolchain_win(compiler, version, runtime):
             settings = "os", "compiler", "build_type", "arch"
             def generate(self):
                 msbuild = MSBuildToolchain(self)
+                msbuild.properties["IncludeExternals"] = "true"
                 msbuild.generate()
             """)
     client.save({"conanfile.py": conanfile})
     client.run("install . {}".format(settings))
     props = client.load("conantoolchain_release_x64.props")
+    assert "<IncludeExternals>true</IncludeExternals>" in props
     assert "<LanguageStandard>stdcpp17</LanguageStandard>" in props
     if version == "190":
         assert "<PlatformToolset>v140</PlatformToolset>" in props
diff --git a/conans/test/functional/tools/old/vcvars/vcvars_arch_test.py b/conans/test/functional/tools/old/vcvars/vcvars_arch_test.py
index c8ddb3570..01ddb370e 100644
--- a/conans/test/functional/tools/old/vcvars/vcvars_arch_test.py
+++ b/conans/test/functional/tools/old/vcvars/vcvars_arch_test.py
@@ -53,6 +53,17 @@ class VCVarsArchTest(unittest.TestCase):
         settings.arch = 'x86'
         self.assert_vcvars_command(settings, "amd64_x86")
 
+        settings.arch_build = 'armv8'
+        settings.arch = 'armv8'
+
+        self.assert_vcvars_command(settings, "arm64")
+
+        settings.arch = 'x86'
+        self.assert_vcvars_command(settings, "arm64_x86")
+
+        settings.arch = 'x86_64'
+        self.assert_vcvars_command(settings, "arm64_x64")
+
     def test_arch_override(self):
         settings = Settings.loads(get_default_settings_yml())
         settings.compiler = 'Visual Studio'
diff --git a/conans/test/functional/tools/scm/test_git.py b/conans/test/functional/tools/scm/test_git.py
index 535c46449..cd1e47c06 100644
--- a/conans/test/functional/tools/scm/test_git.py
+++ b/conans/test/functional/tools/scm/test_git.py
@@ -565,3 +565,23 @@ class TestConanFileSubfolder:
         c.run("create conan")
         assert "pkg/0.1: MYCMAKE: mycmakelists" in c.out
         assert "pkg/0.1: MYFILE: myheader" in c.out
+
+    def test_git_run(self):
+        conanfile = textwrap.dedent("""
+            import os
+            from conan import ConanFile
+            from conan.tools.scm import Git
+
+            class Pkg(ConanFile):
+                name = "pkg"
+                version = "0.1"
+                def export(self):
+                    git = Git(self)
+                    self.output.info(git.run("--version"))
+            """)
+
+        c = TestClient()
+        c.save({"conan/conanfile.py": conanfile})
+        c.init_git_repo()
+        c.run("export conan")
+        assert "pkg/0.1: git version" in c.out
diff --git a/conans/test/functional/tools/test_apple_tools.py b/conans/test/functional/tools/test_apple_tools.py
new file mode 100644
index 000000000..15fba0bcf
--- /dev/null
+++ b/conans/test/functional/tools/test_apple_tools.py
@@ -0,0 +1,26 @@
+import platform
+import textwrap
+
+import pytest
+
+from conans.test.utils.tools import TestClient
+
+
+@pytest.mark.skipif(platform.system() != "Darwin", reason="Requires Xcode")
+def test_xcrun():
+    conanfile = textwrap.dedent("""
+        from conan import ConanFile
+        from conan.tools.apple import XCRun
+
+        class HelloConan(ConanFile):
+            name = "hello"
+            version = "0.1"
+            settings = "os", "compiler", "build_type", "arch"
+            def build(self):
+                sdk_path = XCRun(self).sdk_path
+                self.output.info(sdk_path)
+        """)
+    client = TestClient(path_with_spaces=False)
+    client.save({"conanfile.py": conanfile}, clean_first=True)
+    client.run("create .")
+    assert "Xcode.app/Contents/Developer/Platforms/MacOSX.platform" in client.out
diff --git a/conans/test/integration/layout/test_layout_generate.py b/conans/test/integration/layout/test_layout_generate.py
index e5d59b213..ebe3cf106 100644
--- a/conans/test/integration/layout/test_layout_generate.py
+++ b/conans/test/integration/layout/test_layout_generate.py
@@ -1,6 +1,7 @@
 import os
 import textwrap
 
+from conans.test.assets.genconanfile import GenConanfile
 from conans.test.utils.tools import TestClient
 
 
@@ -48,3 +49,50 @@ def test_layout_generate():
     assert os.path.exists(os.path.join(c.current_folder, "mybuild", "include", "myfile.txt"))
 
 
+def test_generate_source_folder():
+    c = TestClient()
+    conanfile = textwrap.dedent("""
+        import os
+        from conan import ConanFile
+        from conan.tools.cmake import cmake_layout
+
+        class Pkg(ConanFile):
+            settings = "os", "compiler", "build_type", "arch"
+
+            def layout(self):
+                cmake_layout(self)
+
+            def generate(self):
+                self.output.info("PKG_CONFIG_PATH {}!".format(os.path.exists(self.source_folder)))
+        """)
+    c.save({"conanfile.py": conanfile})
+    c.run("install .")
+    assert "PKG_CONFIG_PATH True!" in c.out
+
+
+def test_generate_source_folder_test_package():
+    c = TestClient()
+    conanfile = textwrap.dedent("""
+        import os
+        from conan import ConanFile
+        from conan.tools.cmake import cmake_layout
+
+        class Pkg(ConanFile):
+            settings = "os", "compiler", "build_type", "arch"
+
+            def requirements(self):
+                self.requires(self.tested_reference_str)
+
+            def layout(self):
+                cmake_layout(self)
+
+            def generate(self):
+                self.output.info("PKG_CONFIG_PATH {}!".format(os.path.exists(self.source_folder)))
+
+            def test(self):
+                pass
+        """)
+    c.save({"conanfile.py": GenConanfile("pkg", "1.0"),
+            "test_package/conanfile.py": conanfile})
+    c.run("create .")
+    assert "PKG_CONFIG_PATH True!" in c.out
diff --git a/conans/test/integration/package_id/compatible_test.py b/conans/test/integration/package_id/compatible_test.py
index fb9393812..305dba427 100644
--- a/conans/test/integration/package_id/compatible_test.py
+++ b/conans/test/integration/package_id/compatible_test.py
@@ -4,7 +4,7 @@ import unittest
 
 
 from conans.model.ref import ConanFileReference
-from conans.test.utils.tools import TestClient, GenConanfile
+from conans.test.utils.tools import TestClient, GenConanfile, TestServer
 from conans.util.files import save
 
 
@@ -87,6 +87,53 @@ class CompatibleIDsTest(unittest.TestCase):
         self.assertIn("pkg/0.1@user/stable:53f56fbd582a1898b3b9d16efd6d3c0ec71e7cfb - Build",
                       client.out)
 
+    def test_compatible_setting_debug_release(self):
+        # From issue https://github.com/conan-io/conan/issues/9398
+        client = TestClient(default_server_user=True)
+        conanfile = textwrap.dedent("""\
+            from conan import ConanFile
+            class Pkg(ConanFile):
+                name = "pkga"
+                version = "0.1"
+                settings = "build_type"
+
+                def package_id(self):
+                    compatible_pkg = self.info.clone()
+                    compatible_pkg.settings.build_type = "Release"
+                    self.compatible_packages.append(compatible_pkg)
+            """)
+        client.save({"conanfile.py": conanfile})
+        # Create the recipe and upload it into the remote
+        client.run("create . -s build_type=Release")
+        client.run("upload pkg* -r=default --confirm --all")
+        client.run("remove * -f")
+
+        # Install locally the uploaded package
+        client.run("install pkga/0.1@")
+
+        # Create a middle package and export it
+        conanfile = textwrap.dedent("""\
+            from conan import ConanFile
+
+            class PkgB(ConanFile):
+                name = "pkgb"
+                version = "0.1"
+                build_requires = "pkga/0.1"
+               """)
+        client.save({"conanfile.py": conanfile}, clean_first=True)
+        client.run("export .")
+
+        # Create a final package and install it changing the "build_type"
+        conanfile = textwrap.dedent("""\
+            from conan import ConanFile
+
+            class PkgC(ConanFile):
+               requires = "pkgb/0.1"
+               build_requires = "pkga/0.1"
+               """)
+        client.save({"conanfile.py": conanfile}, clean_first=True)
+        client.run("install . -s build_type=Debug --build=missing")
+
     def test_compatible_setting_no_user_channel(self):
         client = TestClient()
         conanfile = textwrap.dedent("""
diff --git a/conans/test/integration/settings/remove_subsetting_test.py b/conans/test/integration/settings/remove_subsetting_test.py
index 5c8e6d8a2..209838e1b 100644
--- a/conans/test/integration/settings/remove_subsetting_test.py
+++ b/conans/test/integration/settings/remove_subsetting_test.py
@@ -1,4 +1,5 @@
 import os
+import textwrap
 import unittest
 
 from conans.test.utils.tools import TestClient
@@ -144,3 +145,57 @@ class ConanLib(ConanFile):
         client.run("package .")
         self.assertIn("ERROR: PACKAGE 'settings.compiler.libcxx' doesn't exist for 'gcc'",
                       client.out)
+
+
+def test_settings_and_options_rm_safe():
+    client = TestClient()
+    conanfile = textwrap.dedent("""
+    from conan import ConanFile
+    class Pkg(ConanFile):
+        settings = "os", "build_type", "compiler"
+        options = {"opt1": [True, False], "opt2": [True, False]}
+        default_options = "opt1=True", "opt2=False"
+
+        def configure(self):
+            # setting
+            self.settings.rm_safe("build_type")
+            # sub-setting
+            self.settings.rm_safe("compiler.version")
+            # wrong settings
+            self.settings.rm_safe("fake_field")
+            self.settings.rm_safe("fake_field.version")
+
+        def config_options(self):
+            # option
+            self.options.rm_safe("opt2")
+            # wrong option
+            self.options.rm_safe("opt15")
+
+        def build(self):
+            try:
+                self.settings.build_type
+            except Exception as exc:
+                self.output.warn(str(exc))
+            try:
+                self.settings.compiler.version
+            except Exception as exc:
+                self.output.warn(str(exc))
+            try:
+                self.options.opt2
+            except Exception as exc:
+                self.output.warn(str(exc))
+            assert "opt2" not in self.options
+    """)
+    client.save({"conanfile.py": conanfile})
+    build_folder = os.path.join(client.current_folder, "build")
+    mkdir(build_folder)
+    client.current_folder = build_folder
+
+    client.run("install ..")
+    client.run("build ..")
+    assert "'settings.build_type' doesn't exist" in client.out
+    assert "'settings' possible configurations are ['compiler', 'os']" in client.out
+    assert "'settings.compiler.version' doesn't exist" in client.out
+    assert "'settings.compiler' possible configurations are [" in client.out
+    assert "option 'opt2' doesn't exist" in client.out
+    assert "Possible options are ['opt1']" in client.out
diff --git a/conans/test/integration/toolchains/apple/test_xcodedeps.py b/conans/test/integration/toolchains/apple/test_xcodedeps.py
index 68d4d1991..6ec5f1c86 100644
--- a/conans/test/integration/toolchains/apple/test_xcodedeps.py
+++ b/conans/test/integration/toolchains/apple/test_xcodedeps.py
@@ -153,7 +153,7 @@ def test_xcodedeps_aggregate_components():
         assert f"conan_libb_libb_comp{index}.xcconfig" in lib_entry
 
     component7_entry = client.load("conan_libb_libb_comp7.xcconfig")
-    assert '#include "conan_liba_liba.xcconfig"' in component7_entry
+    assert '#include "conan_liba.xcconfig"' in component7_entry
 
     arch_setting = client.get_default_host_profile().settings['arch']
     arch = "arm64" if arch_setting == "armv8" else arch_setting
diff --git a/conans/test/integration/toolchains/apple/test_xcodetoolchain.py b/conans/test/integration/toolchains/apple/test_xcodetoolchain.py
index 457c15a17..1b9967240 100644
--- a/conans/test/integration/toolchains/apple/test_xcodetoolchain.py
+++ b/conans/test/integration/toolchains/apple/test_xcodetoolchain.py
@@ -23,10 +23,10 @@ def _condition(configuration, architecture, sdk_name, sdk_version):
 @pytest.mark.skipif(platform.system() != "Darwin", reason="Only for MacOS")
 @pytest.mark.parametrize("configuration, os_version, libcxx, cppstd, arch, sdk_name, sdk_version, clang_cppstd", [
     ("Release", "", "", "", "x86_64", "", "", ""),
-    ("Release", "12.0", "libc++", "20", "x86_64", "", "", "c++2a"),
-    ("Debug", "12.0", "libc++", "20", "x86_64", "", "", "c++2a"),
-    ("Release", "12.0", "libc++", "20", "x86_64", "macosx", "11.3", "c++2a"),
-    ("Release", "12.0", "libc++", "20", "x86_64", "macosx", "", "c++2a"),
+    ("Release", "12.0", "libc++", "20", "x86_64", "", "", "c++20"),
+    ("Debug", "12.0", "libc++", "20", "x86_64", "", "", "c++20"),
+    ("Release", "12.0", "libc++", "20", "x86_64", "macosx", "11.3", "c++20"),
+    ("Release", "12.0", "libc++", "20", "x86_64", "macosx", "", "c++20"),
 ])
 def test_toolchain_files(configuration, os_version, cppstd, libcxx, arch, sdk_name, sdk_version, clang_cppstd):
     client = TestClient()
diff --git a/conans/test/integration/toolchains/cmake/test_cmaketoolchain.py b/conans/test/integration/toolchains/cmake/test_cmaketoolchain.py
index 8b6f35791..d0bef4d84 100644
--- a/conans/test/integration/toolchains/cmake/test_cmaketoolchain.py
+++ b/conans/test/integration/toolchains/cmake/test_cmaketoolchain.py
@@ -227,7 +227,6 @@ def test_find_builddirs():
 
                 def generate(self):
                     cmake = CMakeToolchain(self)
-                    {}
                     cmake.generate()
             """)
 
@@ -237,6 +236,30 @@ def test_find_builddirs():
         contents = f.read()
         assert "/path/to/builddir" in contents
 
+    conanfile = textwrap.dedent("""
+       import os
+       from conans import ConanFile
+       from conan.tools.cmake import CMakeToolchain
+
+       class Conan(ConanFile):
+           name = "mydep"
+           version = "1.0"
+           settings = "os", "arch", "compiler", "build_type"
+
+           def build_requirements(self):
+               self.test_requires("dep/1.0")
+
+           def generate(self):
+               cmake = CMakeToolchain(self)
+               cmake.generate()
+       """)
+
+    client.save({"conanfile.py": conanfile})
+    client.run("install . ")
+    with open(os.path.join(client.current_folder, "conan_toolchain.cmake")) as f:
+        contents = f.read()
+        assert "/path/to/builddir" in contents
+
 
 @pytest.mark.skipif(platform.system() != "Darwin", reason="Only OSX")
 def test_cmaketoolchain_cmake_system_processor_cross_apple():
@@ -447,17 +470,22 @@ def test_cmake_presets_singleconfig():
 def test_toolchain_cache_variables():
     client = TestClient()
     conanfile = textwrap.dedent("""
-        from conans import ConanFile
-        from conan.tools.cmake import CMakeToolchain, CMake
+        from conan import ConanFile
+        from conan.tools.cmake import CMakeToolchain
 
         class Conan(ConanFile):
             settings = "os", "arch", "compiler", "build_type"
+            options = {"enable_foobar": [True, False], "qux": ["ANY"], "number": [1,2]}
+            default_options = {"enable_foobar": True, "qux": "baz", "number": 1}
 
             def generate(self):
                 toolchain = CMakeToolchain(self)
                 toolchain.cache_variables["foo"] = True
                 toolchain.cache_variables["foo2"] = False
                 toolchain.cache_variables["var"] = "23"
+                toolchain.cache_variables["ENABLE_FOOBAR"] = self.options.enable_foobar
+                toolchain.cache_variables["QUX"] = self.options.qux
+                toolchain.cache_variables["NUMBER"] = self.options.number
                 toolchain.cache_variables["CMAKE_SH"] = "THIS VALUE HAS PRIORITY"
                 toolchain.cache_variables["CMAKE_POLICY_DEFAULT_CMP0091"] = "THIS VALUE HAS PRIORITY"
                 toolchain.cache_variables["CMAKE_MAKE_PROGRAM"] = "THIS VALUE HAS NO PRIORITY"
@@ -476,7 +504,17 @@ def test_toolchain_cache_variables():
     assert cache_variables["CMAKE_POLICY_DEFAULT_CMP0091"] == "THIS VALUE HAS PRIORITY"
     assert cache_variables["CMAKE_MAKE_PROGRAM"] == "MyMake"
     assert cache_variables["BUILD_TESTING"] == 'OFF'
+    assert cache_variables["ENABLE_FOOBAR"] == 'ON'
+    assert cache_variables["QUX"] == 'baz'
+    assert cache_variables["NUMBER"] == 1
+
+    def _format_val(val):
+        return f'"{val}"' if type(val) == str and " " in val else f"{val}"
 
+    for var, value in cache_variables.items():
+        assert f"-D{var}={_format_val(value)}" in client.out
+    assert "-DCMAKE_TOOLCHAIN_FILE=" in client.out
+    assert f"-G {_format_val('MinGW Makefiles')}" in client.out
 
 def test_android_c_library():
     client = TestClient()
diff --git a/conans/test/integration/toolchains/env/test_virtualenv_winbash.py b/conans/test/integration/toolchains/env/test_virtualenv_winbash.py
index e79fdbd0f..dc231f5d8 100644
--- a/conans/test/integration/toolchains/env/test_virtualenv_winbash.py
+++ b/conans/test/integration/toolchains/env/test_virtualenv_winbash.py
@@ -1,9 +1,11 @@
 import os
 import platform
+import textwrap
 
 import pytest
 
 from conans.test.assets.genconanfile import GenConanfile
+from conans.test.conftest import tools_locations
 from conans.test.utils.tools import TestClient
 from conans.tools import save
 
@@ -166,3 +168,54 @@ def test_nowinbash_virtual_cygwin(client):
     assert not os.path.exists(os.path.join(client.current_folder, "conanrunenv.bat"))
     run_contents = client.load("conanrunenv.sh")
     assert 'export RUNTIME_VAR="/cygdrive/c/path/to/exe"' in run_contents
+
+
+@pytest.mark.skipif(platform.system() != "Windows", reason="Requires Windows")
+@pytest.mark.tool_msys2
+def test_conf_inherited_in_test_package():
+    client = TestClient()
+    bash_path = tools_locations["msys2"]["system"]["path"]["Windows"] + "/bash.exe"
+    conanfile = textwrap.dedent("""
+            from conan import ConanFile
+
+            class Recipe(ConanFile):
+                name="msys2"
+                version="1.0"
+
+                def package_info(self):
+                    self.conf_info.define("tools.microsoft.bash:subsystem", "msys2")
+                    self.conf_info.define("tools.microsoft.bash:path", "{}")
+    """.format(bash_path))
+    client.save({"conanfile.py": conanfile})
+    client.run("create .")
+
+    conanfile = textwrap.dedent("""
+                from conan import ConanFile
+
+                class Recipe(ConanFile):
+                    name="consumer"
+                    version="1.0"
+        """)
+    test_package = textwrap.dedent("""
+                    from conan import ConanFile
+
+                    class Recipe(ConanFile):
+                        name="test"
+                        version="1.0"
+                        win_bash = True
+
+                        def build_requirements(self):
+                            self.tool_requires(self.tested_reference_str)
+                            self.tool_requires("msys2/1.0")
+
+                        def build(self):
+                            self.output.warning(self.conf.get("tools.microsoft.bash:subsystem"))
+                            self.run("aclocal --version")
+
+                        def test(self):
+                            pass
+            """)
+    client.save({"conanfile.py": conanfile, "test_package/conanfile.py": test_package})
+    client.run("create . -s:b os=Windows -s:h os=Windows")
+    assert "are needed to run commands in a Windows subsystem" not in client.out
+    assert "aclocal (GNU automake)" in client.out
diff --git a/conans/test/integration/toolchains/microsoft/test_msbuilddeps.py b/conans/test/integration/toolchains/microsoft/test_msbuilddeps.py
index 55f7f9174..0422276c3 100644
--- a/conans/test/integration/toolchains/microsoft/test_msbuilddeps.py
+++ b/conans/test/integration/toolchains/microsoft/test_msbuilddeps.py
@@ -1,5 +1,6 @@
 import os
 import textwrap
+from xml.dom import minidom
 
 import pytest
 
@@ -30,20 +31,24 @@ def test_msbuilddeps_format_names():
         from conan import ConanFile
         class Pkg(ConanFile):
             settings = "os", "compiler", "build_type", "arch"
-            name = "pkg"
+            name = "pkg.name-more+"
             version = "1.0"
 
             def package_info(self):
                 self.cpp_info.components["libmpdecimal++"].libs = ["libmp++"]
+                self.cpp_info.components["mycomp.some-comp+"].libs = ["mylib"]
+                self.cpp_info.components["libmpdecimal++"].requires = ["mycomp.some-comp+"]
         """)
     c.save({"conanfile.py": conanfile})
     c.run("create . -s arch=x86_64")
     # Issue: https://github.com/conan-io/conan/issues/11822
-    c.run("install pkg/1.0@ -g MSBuildDeps -s build_type=Release -s arch=x86_64")
+    c.run("install pkg.name-more+/1.0@ -g MSBuildDeps -s build_type=Release -s arch=x86_64")
     # Checking that MSBuildDeps builds correctly the XML file
-    props = c.load("conan_pkg_libmpdecimal__.props")
-    assert "<conan_pkg_libmpdecimal___props_imported>" in props
-    props = c.load("conan_pkg_libmpdecimal___release_x64.props")
-    assert "Conanpkg_libmpdecimal__IncludeDirectories" in props
-    props = c.load("conan_pkg_libmpdecimal___vars_release_x64.props")
-    assert "<Conanpkg_libmpdecimal__RootFolder>" in props
+    # loading all .props and xml parse them to check no errors
+    counter = 0
+    for f in os.listdir(c.current_folder):
+        if f.endswith(".props"):
+            content = c.load(f)
+            minidom.parseString(content)
+            counter += 1
+    assert counter == 8
diff --git a/conans/test/unittests/client/build/cpp_std_flags_test.py b/conans/test/unittests/client/build/cpp_std_flags_test.py
index 79d60d674..97004dd0c 100644
--- a/conans/test/unittests/client/build/cpp_std_flags_test.py
+++ b/conans/test/unittests/client/build/cpp_std_flags_test.py
@@ -201,6 +201,21 @@ class CompilerFlagsTest(unittest.TestCase):
 
         self.assertEqual(_make_cppstd_flag("apple-clang", "12.0", "17"), "-std=c++17")
         self.assertEqual(_make_cppstd_flag("apple-clang", "12.0", "20"), "-std=c++2a")
+        self.assertEqual(_make_cppstd_flag("apple-clang", "12.0", "23"), None)
+
+        self.assertEqual(_make_cppstd_flag("apple-clang", "13.0", "17"), "-std=c++17")
+        self.assertEqual(_make_cppstd_flag("apple-clang", "13.0", "gnu17"), "-std=gnu++17")
+        self.assertEqual(_make_cppstd_flag("apple-clang", "13.0", "20"), "-std=c++20")
+        self.assertEqual(_make_cppstd_flag("apple-clang", "13.0", "gnu20"), "-std=gnu++20")
+        self.assertEqual(_make_cppstd_flag("apple-clang", "13.0", "23"), "-std=c++2b")
+        self.assertEqual(_make_cppstd_flag("apple-clang", "13.0", "gnu23"), "-std=gnu++2b")
+
+        self.assertEqual(_make_cppstd_flag("apple-clang", "14.0", "17"), "-std=c++17")
+        self.assertEqual(_make_cppstd_flag("apple-clang", "14.0", "gnu17"), "-std=gnu++17")
+        self.assertEqual(_make_cppstd_flag("apple-clang", "14.0", "20"), "-std=c++20")
+        self.assertEqual(_make_cppstd_flag("apple-clang", "14.0", "gnu20"), "-std=gnu++20")
+        self.assertEqual(_make_cppstd_flag("apple-clang", "14.0", "23"), "-std=c++2b")
+        self.assertEqual(_make_cppstd_flag("apple-clang", "14.0", "gnu23"), "-std=gnu++2b")
 
     def test_apple_clang_cppstd_defaults(self):
         self.assertEqual(_make_cppstd_default("apple-clang", "2"), "gnu98")
@@ -214,6 +229,8 @@ class CompilerFlagsTest(unittest.TestCase):
         self.assertEqual(_make_cppstd_default("apple-clang", "10"), "gnu98")
         self.assertEqual(_make_cppstd_default("apple-clang", "11"), "gnu98")
         self.assertEqual(_make_cppstd_default("apple-clang", "12"), "gnu98")
+        self.assertEqual(_make_cppstd_default("apple-clang", "13"), "gnu98")
+        self.assertEqual(_make_cppstd_default("apple-clang", "14"), "gnu98")
 
     def test_visual_cppstd_flags(self):
         self.assertEqual(_make_cppstd_flag("Visual Studio", "12", "11"), None)
diff --git a/conans/test/unittests/client/toolchain/autotools/autotools_toolchain_test.py b/conans/test/unittests/client/toolchain/autotools/autotools_toolchain_test.py
index fb9ba0231..acbe860bb 100644
--- a/conans/test/unittests/client/toolchain/autotools/autotools_toolchain_test.py
+++ b/conans/test/unittests/client/toolchain/autotools/autotools_toolchain_test.py
@@ -152,7 +152,7 @@ def test_ndebug():
     ("clang", 'libstdc++11', '-stdlib=libstdc++'),
     ("clang", 'libc++', '-stdlib=libc++'),
     ("apple-clang", 'libstdc++', '-stdlib=libstdc++'),
-    ("apple-clang", 'libstdc++11', '-stdlib=libstdc++'),
+    # ("apple-clang", 'libstdc++11', '-stdlib=libstdc++'), # this is invalid input
     ("apple-clang", 'libc++', '-stdlib=libc++'),
     ("sun-cc", 'libCstd', '-library=Cstd'),
     ("sun-cc", 'libstdcxx', '-library=stdcxx4'),
diff --git a/conans/test/unittests/tools/build/test_cppstd.py b/conans/test/unittests/tools/build/test_cppstd.py
index f81c30465..4b915ff9e 100644
--- a/conans/test/unittests/tools/build/test_cppstd.py
+++ b/conans/test/unittests/tools/build/test_cppstd.py
@@ -67,6 +67,8 @@ def test_supported_cppstd_gcc(compiler, compiler_version, values):
     ("apple-clang", "9.5", ['98', 'gnu98', '11', 'gnu11', "14", "gnu14", "17", "gnu17"]),
     ("apple-clang", "10", ['98', 'gnu98', '11', 'gnu11', "14", "gnu14", "17", "gnu17", "20",
                            "gnu20"]),
+    ("apple-clang", "13", ['98', 'gnu98', '11', 'gnu11', "14", "gnu14", "17", "gnu17", "20",
+                           "gnu20", "23", "gnu23"]),
 ])
 def test_supported_cppstd_apple_clang(compiler, compiler_version, values):
     settings = MockSettings({"compiler": compiler, "compiler.version": compiler_version})
diff --git a/conans/test/unittests/tools/cmake/test_cmaketoolchain.py b/conans/test/unittests/tools/cmake/test_cmaketoolchain.py
index 123fb38b9..2fac1acfd 100644
--- a/conans/test/unittests/tools/cmake/test_cmaketoolchain.py
+++ b/conans/test/unittests/tools/cmake/test_cmaketoolchain.py
@@ -402,7 +402,7 @@ def test_libcxx_abi_flag():
     # by default, no flag is output anymore, it is assumed the compiler default
     assert 'GLIBCXX_USE_CXX11_ABI' not in content
     # recipe workaround for older distros
-    toolchain.blocks["libcxx"].values["glibcxx"] = "1"
+    toolchain.blocks["libcxx"].values["glibcxx"] = "_GLIBCXX_USE_CXX11_ABI=1"
     content = toolchain.content
     assert '_GLIBCXX_USE_CXX11_ABI=1' in content