Repository: conan-io/conan
Pull request #18489 (2025-06-18 15:36:17)

implementing support for exe editables in CMakeConfigDeps
Changelog: Feature: Added support for ``.exe`` in editables packages in ``CMakeConfigDeps``.
Docs: Omit

Close https://github.com/conan-io/conan/issues/18460


Patch:
diff --git a/conan/internal/model/cpp_info.py b/conan/internal/model/cpp_info.py
index ebb4c0f85..bf60b1b24 100644
--- a/conan/internal/model/cpp_info.py
+++ b/conan/internal/model/cpp_info.py
@@ -15,6 +15,7 @@ _DIRS_VAR_NAMES = ["_includedirs", "_srcdirs", "_libdirs", "_resdirs", "_bindirs
 _FIELD_VAR_NAMES = ["_system_libs", "_package_framework", "_frameworks", "_libs", "_defines",
                     "_cflags", "_cxxflags", "_sharedlinkflags", "_exelinkflags", "_sources"]
 _ALL_NAMES = _DIRS_VAR_NAMES + _FIELD_VAR_NAMES
+_SINGLE_VALUE_VARS = "_type", "_exe", "_location", "_link_location", "_languages"
 
 
 class MockInfoProperty:
@@ -461,6 +462,12 @@ class _Component:
                 else:
                     setattr(self, varname, other_values)
 
+        for varname in _SINGLE_VALUE_VARS:  # To allow editable of .exe/.location
+            other_values = getattr(other, varname)
+            if other_values is not None:
+                # Just overwrite the existing value, not possible to append
+                setattr(self, varname, other_values)
+
         if other.requires:
             current_values = self.get_init("requires", [])
             merge_list(other.requires, current_values)
diff --git a/conan/tools/apple/apple.py b/conan/tools/apple/apple.py
index 8afda1ad2..0e3d7efce 100644
--- a/conan/tools/apple/apple.py
+++ b/conan/tools/apple/apple.py
@@ -334,20 +334,14 @@ def apple_extra_flags(conanfile):
     if not is_apple_os(conanfile):
         return []
     enable_bitcode = conanfile.conf.get("tools.apple:enable_bitcode", check_type=bool)
-    enable_arc = conanfile.conf.get("tools.apple:enable_arc", check_type=bool)
     enable_visibility = conanfile.conf.get("tools.apple:enable_visibility", check_type=bool)
     is_debug = conanfile.settings.get_safe('build_type') == "Debug"
-
     flags = []
     if enable_bitcode:
         if is_debug:
             flags.append("-fembed-bitcode-marker")
         else:
             flags.append("-fembed-bitcode")
-    if enable_arc:
-        flags.append("-fobjc-arc")
-    if enable_arc is False:
-        flags.append("-fno-objc-arc")
     if enable_visibility:
         flags.append("-fvisibility=default")
     if enable_visibility is False:
diff --git a/conan/tools/cmake/toolchain/blocks.py b/conan/tools/cmake/toolchain/blocks.py
index 951aa2662..2df118716 100644
--- a/conan/tools/cmake/toolchain/blocks.py
+++ b/conan/tools/cmake/toolchain/blocks.py
@@ -464,8 +464,11 @@ class AppleSystemBlock(Block):
         if(CMAKE_GENERATOR MATCHES "Xcode")
           message(DEBUG "Not setting any manual command-line buildflags, since Xcode is selected as generator.")
         else()
-            string(APPEND CONAN_C_FLAGS " ${BITCODE} ${VISIBILITY} ${FOBJC_ARC}")
-            string(APPEND CONAN_CXX_FLAGS " ${BITCODE} ${VISIBILITY} ${FOBJC_ARC}")
+            string(APPEND CONAN_C_FLAGS " ${BITCODE} ${VISIBILITY}")
+            string(APPEND CONAN_CXX_FLAGS " ${BITCODE} ${VISIBILITY}")
+            # Objective-C/C++ specific flags
+            string(APPEND CONAN_OBJC_FLAGS " ${BITCODE} ${VISIBILITY} ${FOBJC_ARC}")
+            string(APPEND CONAN_OBJCXX_FLAGS " ${BITCODE} ${VISIBILITY} ${FOBJC_ARC}")
         endif()
         """)
 
@@ -852,6 +855,12 @@ class CMakeFlagsInitBlock(Block):
         if(DEFINED CONAN_EXE_LINKER_FLAGS)
           string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${CONAN_EXE_LINKER_FLAGS}")
         endif()
+        if(DEFINED CONAN_OBJCXX_FLAGS)
+          string(APPEND CMAKE_OBJCXX_FLAGS_INIT " ${CONAN_OBJCXX_FLAGS}")
+        endif()
+        if(DEFINED CONAN_OBJC_FLAGS)
+          string(APPEND CMAKE_OBJC_FLAGS_INIT " ${CONAN_OBJC_FLAGS}")
+        endif()
         """)
 
 
diff --git a/conan/tools/gnu/autotoolstoolchain.py b/conan/tools/gnu/autotoolstoolchain.py
index f2e454474..bb3168df4 100644
--- a/conan/tools/gnu/autotoolstoolchain.py
+++ b/conan/tools/gnu/autotoolstoolchain.py
@@ -243,6 +243,17 @@ class AutotoolsToolchain:
         ret = [self.ndebug, self.gcc_cxx11_abi] + self.extra_defines + conf_flags
         return self._filter_list_empty_fields(ret)
 
+    def _include_obj_arc_flags(self, env):
+        enable_arc = self._conanfile.conf.get("tools.apple:enable_arc", check_type=bool)
+        fobj_arc = ""
+        if enable_arc:
+            fobj_arc = "-fobjc-arc"
+        if enable_arc is False:
+            fobj_arc = "-fno-objc-arc"
+        if fobj_arc:
+            env.append('OBJCFLAGS', [fobj_arc])
+            env.append('OBJCXXFLAGS', [fobj_arc])
+
     def environment(self):
         env = Environment()
         # Setting Android cross-compilation flags (if exist)
@@ -276,6 +287,8 @@ class AutotoolsToolchain:
         env.append("CFLAGS", self.cflags)
         env.append("LDFLAGS", self.ldflags)
         env.prepend_path("PKG_CONFIG_PATH", self._conanfile.generators_folder)
+        # Objective C/C++
+        self._include_obj_arc_flags(env)
         # Issue related: https://github.com/conan-io/conan/issues/15486
         if self._is_cross_building and self._conanfile.conf_build:
             compilers_build_mapping = (
diff --git a/conan/tools/gnu/gnutoolchain.py b/conan/tools/gnu/gnutoolchain.py
index 800cb35b4..d7cd0a384 100644
--- a/conan/tools/gnu/gnutoolchain.py
+++ b/conan/tools/gnu/gnutoolchain.py
@@ -337,6 +337,17 @@ class GnuToolchain:
                 triplets[f"--{context}"] = info["triplet"]
         return triplets
 
+    def _include_obj_arc_flags(self, env):
+        enable_arc = self._conanfile.conf.get("tools.apple:enable_arc", check_type=bool)
+        fobj_arc = ""
+        if enable_arc:
+            fobj_arc = "-fobjc-arc"
+        if enable_arc is False:
+            fobj_arc = "-fno-objc-arc"
+        if fobj_arc:
+            env.append('OBJCFLAGS', [fobj_arc])
+            env.append('OBJCXXFLAGS', [fobj_arc])
+
     @property
     def _environment(self):
         env = Environment()
@@ -346,6 +357,8 @@ class GnuToolchain:
         env.append("CFLAGS", self.cflags)
         env.append("LDFLAGS", self.ldflags)
         env.prepend_path("PKG_CONFIG_PATH", self._conanfile.generators_folder)
+        # Objective C/C++
+        self._include_obj_arc_flags(env)
         # Let's compose with user extra env variables defined (user ones have precedence)
         return self.extra_env.compose_env(env)
 
diff --git a/conan/tools/meson/toolchain.py b/conan/tools/meson/toolchain.py
index 5014c1348..8dd569ee4 100644
--- a/conan/tools/meson/toolchain.py
+++ b/conan/tools/meson/toolchain.py
@@ -403,11 +403,18 @@ class MesonToolchain:
         self.apple_isysroot_flag = isysroot_flag.split() if isysroot_flag else []
         self.apple_min_version_flag = [apple_min_version_flag(self._conanfile)]
         # Objective C/C++ ones
+        flags = []
         self.objc = compilers_by_conf.get("objc", "clang")
         self.objcpp = compilers_by_conf.get("objcpp", "clang++")
-        self.objc_args = self._get_env_list(build_env.get('OBJCFLAGS', []))
+        enable_arc = self._conanfile.conf.get("tools.apple:enable_arc", check_type=bool)
+        fobj_arc = ""
+        if enable_arc:
+            fobj_arc = "-fobjc-arc"
+        if enable_arc is False:
+            fobj_arc = "-fno-objc-arc"
+        self.objc_args = self._get_env_list(build_env.get('OBJCFLAGS', [])) + [fobj_arc]
         self.objc_link_args = self._get_env_list(build_env.get('LDFLAGS', []))
-        self.objcpp_args = self._get_env_list(build_env.get('OBJCXXFLAGS', []))
+        self.objcpp_args = self._get_env_list(build_env.get('OBJCXXFLAGS', [])) + [fobj_arc]
         self.objcpp_link_args = self._get_env_list(build_env.get('LDFLAGS', []))
 
     def _resolve_android_cross_compilation(self):
@@ -474,6 +481,7 @@ class MesonToolchain:
         ret = [x.strip() for x in value.split() if x]
         return ret[0] if len(ret) == 1 else ret
 
+    @property
     def _context(self):
         apple_flags = self.apple_isysroot_flag + self.apple_arch_flag + self.apple_min_version_flag
         extra_flags = self._get_extra_flags()
@@ -483,11 +491,11 @@ class MesonToolchain:
         self.c_link_args.extend(apple_flags + extra_flags["ldflags"])
         self.cpp_link_args.extend(apple_flags + extra_flags["ldflags"])
         # Objective C/C++
-        self.objc_args.extend(self.c_args + extra_flags["defines"])
-        self.objcpp_args.extend(self.cpp_args + extra_flags["defines"])
+        self.objc_args.extend(self.c_args)
+        self.objcpp_args.extend(self.cpp_args)
         # These link_args have already the LDFLAGS env value so let's add only the new possible ones
-        self.objc_link_args.extend(apple_flags + extra_flags["ldflags"])
-        self.objcpp_link_args.extend(apple_flags + extra_flags["ldflags"])
+        self.objc_link_args.extend(self.c_link_args)
+        self.objcpp_link_args.extend(self.cpp_link_args)
 
         if self.libcxx:
             self.cpp_args.append(self.libcxx)
@@ -502,7 +510,6 @@ class MesonToolchain:
                     raise ConanException("MesonToolchain.subproject_options must be a list of dicts")
                 subproject_options[subproject] = [{k: to_meson_value(v) for k, v in keypair.items()}
                                                   for keypair in listkeypair]
-
         return {
             # https://mesonbuild.com/Machine-files.html#properties
             "properties": {k: to_meson_value(v) for k, v in self.properties.items()},
@@ -567,7 +574,7 @@ class MesonToolchain:
 
         :return: ``str`` whole Meson context content.
         """
-        context = self._context()
+        context = self._context
         content = Template(self._meson_file_template, trim_blocks=True, lstrip_blocks=True,
                            undefined=StrictUndefined).render(context)
         return content


Test patch:
diff --git a/test/functional/toolchains/cmake/cmakedeps2/test_cmakeconfigdeps_new.py b/test/functional/toolchains/cmake/cmakedeps2/test_cmakeconfigdeps_new.py
index 3bee9360f..3ca484d4f 100644
--- a/test/functional/toolchains/cmake/cmakedeps2/test_cmakeconfigdeps_new.py
+++ b/test/functional/toolchains/cmake/cmakedeps2/test_cmakeconfigdeps_new.py
@@ -15,12 +15,12 @@ new_value = "will_break_next"
 
 @pytest.mark.tool("cmake")
 class TestExes:
-    @pytest.mark.parametrize("tool_requires", [False, True])
-    def test_exe(self, tool_requires):
+    @pytest.mark.parametrize("editable", [False, True])
+    def test_exe(self, editable):
         conanfile = textwrap.dedent(r"""
-            import os
+            import os, platform
             from conan import ConanFile
-            from conan.tools.cmake import CMake
+            from conan.tools.cmake import CMake, cmake_layout
 
             class Test(ConanFile):
                 name = "mytool"
@@ -30,6 +30,13 @@ class TestExes:
                 generators = "CMakeToolchain"
                 exports_sources = "*"
 
+                def layout(self):
+                    cmake_layout(self)
+                    self.cpp.build.exe = "mytool"
+                    name = "mytool.exe" if platform.system() == "Windows" else "mytool"
+                    app_loc = os.path.join("build", str(self.settings.build_type), name)
+                    self.cpp.build.location = app_loc
+
                 def build(self):
                     cmake = CMake(self)
                     cmake.configure()
@@ -57,46 +64,48 @@ class TestExes:
         c.run("new cmake_exe -d name=mytool -d version=0.1")
         c.save({"conanfile.py": conanfile,
                 "src/main.cpp": main})
+        if editable:
+            c.run("editable add .")
         c.run("create .")
 
-        requires = "tool_requires" if tool_requires else "requires"
-        consumer = textwrap.dedent(f"""
-            from conan import ConanFile
-            from conan.tools.cmake import CMakeDeps, CMakeToolchain, CMake, cmake_layout
-            class Consumer(ConanFile):
-                settings = "os", "compiler", "arch", "build_type"
-                {requires} = "mytool/0.1"
-
-                def generate(self):
-                    deps = CMakeDeps(self)
-                    deps.generate()
-                    tc = CMakeToolchain(self)
-                    tc.generate()
-
-                def layout(self):
-                    cmake_layout(self)
-                def build(self):
-                    cmake = CMake(self)
-                    cmake.configure()
-                    cmake.build()
-            """)
-        cmake = textwrap.dedent("""
-            set(CMAKE_C_COMPILER_WORKS 1)
-            set(CMAKE_C_ABI_COMPILED 1)
-            cmake_minimum_required(VERSION 3.15)
-            project(consumer C)
-
-            find_package(mytool)
-            add_custom_command(OUTPUT out.c COMMAND MyTool::myexe)
-            add_library(myLib out.c)
-            """)
-        c.save({"conanfile.py": consumer,
-                "CMakeLists.txt": cmake}, clean_first=True)
-        c.run(f"build . -c tools.cmake.cmakedeps:new={new_value}")
-        assert "find_package(mytool)" in c.out
-        assert "target_link_libraries(..." not in c.out
-        assert "Conan: Target declared imported executable 'MyTool::myexe'" in c.out
-        assert "Mytool generating out.c!!!!!" in c.out
+        for requires in ("tool_requires", "requires"):
+            consumer = textwrap.dedent(f"""
+                from conan import ConanFile
+                from conan.tools.cmake import CMakeDeps, CMakeToolchain, CMake, cmake_layout
+                class Consumer(ConanFile):
+                    settings = "os", "compiler", "arch", "build_type"
+                    {requires} = "mytool/0.1"
+
+                    def generate(self):
+                        deps = CMakeDeps(self)
+                        deps.generate()
+                        tc = CMakeToolchain(self)
+                        tc.generate()
+
+                    def layout(self):
+                        cmake_layout(self)
+                    def build(self):
+                        cmake = CMake(self)
+                        cmake.configure()
+                        cmake.build()
+                """)
+            cmake = textwrap.dedent("""
+                set(CMAKE_C_COMPILER_WORKS 1)
+                set(CMAKE_C_ABI_COMPILED 1)
+                cmake_minimum_required(VERSION 3.15)
+                project(consumer C)
+
+                find_package(mytool)
+                add_custom_command(OUTPUT out.c COMMAND MyTool::myexe)
+                add_library(myLib out.c)
+                """)
+            c.save({f"consumer_{requires}/conanfile.py": consumer,
+                    f"consumer_{requires}/CMakeLists.txt": cmake})
+            c.run(f"build consumer_{requires} -c tools.cmake.cmakedeps:new={new_value}")
+            assert "find_package(mytool)" in c.out
+            assert "target_link_libraries(..." not in c.out
+            assert "Conan: Target declared imported executable 'MyTool::myexe'" in c.out
+            assert "Mytool generating out.c!!!!!" in c.out
 
     def test_exe_components(self):
         conanfile = textwrap.dedent(r"""
diff --git a/test/functional/toolchains/cmake/test_cmake_toolchain_xcode_flags.py b/test/functional/toolchains/cmake/test_cmake_toolchain_xcode_flags.py
index 0cfc20661..16f0881f0 100644
--- a/test/functional/toolchains/cmake/test_cmake_toolchain_xcode_flags.py
+++ b/test/functional/toolchains/cmake/test_cmake_toolchain_xcode_flags.py
@@ -12,6 +12,8 @@ def _add_message_status_flags(client):
     with open(cmakelists_path, "a") as cmakelists_file:
         cmakelists_file.write('message(STATUS "CONAN_C_FLAGS: ${CONAN_C_FLAGS}")\n')
         cmakelists_file.write('message(STATUS "CONAN_CXX_FLAGS: ${CONAN_CXX_FLAGS}")\n')
+        cmakelists_file.write('message(STATUS "CONAN_OBJC_FLAGS: ${CONAN_OBJC_FLAGS}")\n')
+        cmakelists_file.write('message(STATUS "CONAN_OBJCXX_FLAGS: ${CONAN_OBJCXX_FLAGS}")\n')
 
 
 @pytest.mark.skipif(platform.system() != "Darwin", reason="Only OSX")
@@ -52,8 +54,10 @@ def test_cmake_apple_bitcode_arc_and_visibility_flags_enabled(op_system, os_vers
 
     client.run("create . --profile:build=default --profile:host=host -tf=")
     # flags
-    assert "-- CONAN_C_FLAGS:  -fembed-bitcode -fvisibility=default -fobjc-arc" in client.out
-    assert "-- CONAN_CXX_FLAGS:  -fembed-bitcode -fvisibility=default -fobjc-arc" in client.out
+    assert "-- CONAN_C_FLAGS:  -fembed-bitcode -fvisibility=default" in client.out
+    assert "-- CONAN_CXX_FLAGS:  -fembed-bitcode -fvisibility=default" in client.out
+    assert "-- CONAN_OBJC_FLAGS:  -fembed-bitcode -fvisibility=default -fobjc-arc" in client.out
+    assert "-- CONAN_OBJCXX_FLAGS:  -fembed-bitcode -fvisibility=default -fobjc-arc" in client.out
     assert "[100%] Built target hello" in client.out
 
 
@@ -136,8 +140,10 @@ def test_cmake_apple_bitcode_arc_and_visibility_flags_disabled(op_system, os_ver
 
     client.run("create . --profile:build=default --profile:host=host -tf=\"\"")
     # flags
-    assert "-- CONAN_C_FLAGS:   -fvisibility=hidden -fvisibility-inlines-hidden -fno-objc-arc" in client.out
-    assert "-- CONAN_CXX_FLAGS:   -fvisibility=hidden -fvisibility-inlines-hidden -fno-objc-arc" in client.out
+    assert "-- CONAN_C_FLAGS:   -fvisibility=hidden -fvisibility-inlines-hidden" in client.out
+    assert "-- CONAN_CXX_FLAGS:   -fvisibility=hidden -fvisibility-inlines-hidden" in client.out
+    assert "-- CONAN_OBJC_FLAGS:   -fvisibility=hidden -fvisibility-inlines-hidden -fno-objc-arc" in client.out
+    assert "-- CONAN_OBJCXX_FLAGS:   -fvisibility=hidden -fvisibility-inlines-hidden -fno-objc-arc" in client.out
     assert "[100%] Built target hello" in client.out
 
 
diff --git a/test/integration/toolchains/gnu/test_gnutoolchain.py b/test/integration/toolchains/gnu/test_gnutoolchain.py
index e05754916..6493a3be2 100644
--- a/test/integration/toolchains/gnu/test_gnutoolchain.py
+++ b/test/integration/toolchains/gnu/test_gnutoolchain.py
@@ -476,15 +476,19 @@ def test_conf_extra_apple_flags(toolchain):
     c.run("install . -pr:a host")
     f = "conanautotoolstoolchain.sh" if toolchain == "AutotoolsToolchain" else "conangnutoolchain.sh"
     tc = c.load(f)
-    assert 'export CXXFLAGS="$CXXFLAGS -fembed-bitcode -fobjc-arc -fvisibility=default"' in tc
-    assert 'export CFLAGS="$CFLAGS -fembed-bitcode -fobjc-arc -fvisibility=default"' in tc
-    assert 'export LDFLAGS="$LDFLAGS -fembed-bitcode -fobjc-arc -fvisibility=default"' in tc
+    assert 'export CXXFLAGS="$CXXFLAGS -fembed-bitcode -fvisibility=default"' in tc
+    assert 'export CFLAGS="$CFLAGS -fembed-bitcode -fvisibility=default"' in tc
+    assert 'export LDFLAGS="$LDFLAGS -fembed-bitcode -fvisibility=default"' in tc
+    assert 'export OBJCFLAGS="$OBJCFLAGS -fobjc-arc"' in tc
+    assert 'export OBJCXXFLAGS="$OBJCXXFLAGS -fobjc-arc"' in tc
 
     c.run("install . -pr:a host -s build_type=Debug")
     tc = c.load(f)
-    assert 'export CXXFLAGS="$CXXFLAGS -fembed-bitcode-marker -fobjc-arc -fvisibility=default"' in tc
-    assert 'export CFLAGS="$CFLAGS -fembed-bitcode-marker -fobjc-arc -fvisibility=default"' in tc
-    assert 'export LDFLAGS="$LDFLAGS -fembed-bitcode-marker -fobjc-arc -fvisibility=default"' in tc
+    assert 'export CXXFLAGS="$CXXFLAGS -fembed-bitcode-marker -fvisibility=default"' in tc
+    assert 'export CFLAGS="$CFLAGS -fembed-bitcode-marker -fvisibility=default"' in tc
+    assert 'export LDFLAGS="$LDFLAGS -fembed-bitcode-marker -fvisibility=default"' in tc
+    assert 'export OBJCFLAGS="$OBJCFLAGS -fobjc-arc"' in tc
+    assert 'export OBJCXXFLAGS="$OBJCXXFLAGS -fobjc-arc"' in tc
 
     host = textwrap.dedent("""
         [settings]
@@ -499,9 +503,11 @@ def test_conf_extra_apple_flags(toolchain):
     c.save({"host": host})
     c.run("install . -pr:a host")
     tc = c.load(f)
-    assert 'CXXFLAGS="$CXXFLAGS -fno-objc-arc -fvisibility=hidden -fvisibility-inlines-hidden"' in tc
-    assert 'CFLAGS="$CFLAGS -fno-objc-arc -fvisibility=hidden -fvisibility-inlines-hidden"' in tc
-    assert 'LDFLAGS="$LDFLAGS -fno-objc-arc -fvisibility=hidden -fvisibility-inlines-hidden"' in tc
+    assert 'CXXFLAGS="$CXXFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"' in tc
+    assert 'CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"' in tc
+    assert 'LDFLAGS="$LDFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"' in tc
+    assert 'export OBJCFLAGS="$OBJCFLAGS -fno-objc-arc"' in tc
+    assert 'export OBJCXXFLAGS="$OBJCXXFLAGS -fno-objc-arc"' in tc
 
 
 def test_toolchain_crossbuild_to_android():
diff --git a/test/integration/toolchains/meson/test_mesontoolchain.py b/test/integration/toolchains/meson/test_mesontoolchain.py
index 3b5411212..c1a7e8306 100644
--- a/test/integration/toolchains/meson/test_mesontoolchain.py
+++ b/test/integration/toolchains/meson/test_mesontoolchain.py
@@ -768,13 +768,15 @@ def test_conf_extra_apple_flags():
     f = "conan_meson_native.ini"
     tc = c.load(f)
     for flags in ["c_args", "cpp_args", "c_link_args", "cpp_link_args"]:
-        assert f"{flags} = ['-m64', '-fembed-bitcode', '-fobjc-arc', '-fvisibility=default']" in tc
-
+        assert f"{flags} = ['-m64', '-fembed-bitcode', '-fvisibility=default']" in tc
+    for flags in ["objcpp_args", "objc_args"]:
+        assert f"{flags} = ['-fobjc-arc', '-m64', '-fembed-bitcode', '-fvisibility=default']" in tc
     c.run("install . -pr:a host -s build_type=Debug")
     tc = c.load(f)
     for flags in ["c_args", "cpp_args", "c_link_args", "cpp_link_args"]:
-        assert f"{flags} = ['-m64', '-fembed-bitcode-marker'," \
-               " '-fobjc-arc', '-fvisibility=default']" in tc
+        assert f"{flags} = ['-m64', '-fembed-bitcode-marker', '-fvisibility=default']" in tc
+    for flags in ["objcpp_args", "objc_args"]:
+        assert f"{flags} = ['-fobjc-arc', '-m64', '-fembed-bitcode-marker', '-fvisibility=default']" in tc
 
     host = textwrap.dedent("""
         [settings]
@@ -792,5 +794,6 @@ def test_conf_extra_apple_flags():
     c.run("install . -pr:a host")
     tc = c.load(f)
     for flags in ["c_args", "cpp_args", "c_link_args", "cpp_link_args"]:
-        assert f"{flags} = ['-m64', '-fno-objc-arc', '-fvisibility=hidden', " \
-               "'-fvisibility-inlines-hidden']" in tc
+        assert f"{flags} = ['-m64', '-fvisibility=hidden', '-fvisibility-inlines-hidden']" in tc
+    for flags in ["objcpp_args", "objc_args"]:
+        assert f"{flags} = ['-fno-objc-arc', '-m64', '-fvisibility=hidden', '-fvisibility-inlines-hidden']" in tc