Repository: conan-io/conan

Issue:
add list of packages to conanbuildinfo.cmake



Discussion:

Resolving patch:
diff --git a/conans/client/generators/cmake.py b/conans/client/generators/cmake.py
--- a/conans/client/generators/cmake.py
+++ b/conans/client/generators/cmake.py
@@ -50,21 +50,23 @@ def content(self):
         # GENERAL VARIABLES
         deps = DepsCppCmake(self.deps_build_info)
 
-        template = ('set(CONAN_INCLUDE_DIRS {deps.include_paths} ${{CONAN_INCLUDE_DIRS}})\n'
-            'set(CONAN_LIB_DIRS {deps.lib_paths} ${{CONAN_LIB_DIRS}})\n'
-            'set(CONAN_BIN_DIRS {deps.bin_paths} ${{CONAN_BIN_DIRS}})\n'
-            'set(CONAN_LIBS {deps.libs} ${{CONAN_LIBS}})\n'
-            'set(CONAN_DEFINES {deps.defines} ${{CONAN_DEFINES}})\n'
-            'set(CONAN_CXX_FLAGS "{deps.cppflags} ${{CONAN_CXX_FLAGS}}")\n'
-            'set(CONAN_SHARED_LINKER_FLAGS "{deps.sharedlinkflags} ${{CONAN_SHARED_LINKER_FLAGS}}")\n'
-            'set(CONAN_EXE_LINKER_FLAGS "{deps.exelinkflags} ${{CONAN_EXE_LINKER_FLAGS}}")\n'
-            'set(CONAN_C_FLAGS "{deps.cflags} ${{CONAN_C_FLAGS}}")\n'
-            'set(CONAN_CMAKE_MODULE_PATH {module_paths} ${{CONAN_CMAKE_MODULE_PATH}})')
+        template = ('set(CONAN_DEPENDENCIES {dependencies})\n'
+                    'set(CONAN_INCLUDE_DIRS {deps.include_paths} ${{CONAN_INCLUDE_DIRS}})\n'
+                    'set(CONAN_LIB_DIRS {deps.lib_paths} ${{CONAN_LIB_DIRS}})\n'
+                    'set(CONAN_BIN_DIRS {deps.bin_paths} ${{CONAN_BIN_DIRS}})\n'
+                    'set(CONAN_LIBS {deps.libs} ${{CONAN_LIBS}})\n'
+                    'set(CONAN_DEFINES {deps.defines} ${{CONAN_DEFINES}})\n'
+                    'set(CONAN_CXX_FLAGS "{deps.cppflags} ${{CONAN_CXX_FLAGS}}")\n'
+                    'set(CONAN_SHARED_LINKER_FLAGS "{deps.sharedlinkflags} ${{CONAN_SHARED_LINKER_FLAGS}}")\n'
+                    'set(CONAN_EXE_LINKER_FLAGS "{deps.exelinkflags} ${{CONAN_EXE_LINKER_FLAGS}}")\n'
+                    'set(CONAN_C_FLAGS "{deps.cflags} ${{CONAN_C_FLAGS}}")\n'
+                    'set(CONAN_CMAKE_MODULE_PATH {module_paths} ${{CONAN_CMAKE_MODULE_PATH}})')
 
         rootpaths = [DepsCppCmake(dep_cpp_info).rootpath for _, dep_cpp_info
                      in self.deps_build_info.dependencies]
         module_paths = " ".join(rootpaths)
-        all_flags = template.format(deps=deps, module_paths=module_paths)
+        all_flags = template.format(deps=deps, module_paths=module_paths,
+                                    dependencies=" ".join(self.deps_build_info.deps))
         sections.append(all_flags)
 
         # MACROS
diff --git a/conans/model/build_info.py b/conans/model/build_info.py
--- a/conans/model/build_info.py
+++ b/conans/model/build_info.py
@@ -4,6 +4,7 @@
 from conans.client.generators import TXTGenerator
 from conans.util.log import logger
 import traceback
+from collections import OrderedDict
 
 
 DEFAULT_INCLUDE = "include"
@@ -69,12 +70,16 @@ class DepsCppInfo(_CppInfo):
 
     def __init__(self):
         super(DepsCppInfo, self).__init__()
-        self._dependencies = {}
+        self._dependencies = OrderedDict()
 
     @property
     def dependencies(self):
         return self._dependencies.items()
 
+    @property
+    def deps(self):
+        return self._dependencies.keys()
+
     def __getitem__(self, item):
         return self._dependencies[item]
 


Test patch:
diff --git a/conans/test/integration/diamond_test.py b/conans/test/integration/diamond_test.py
--- a/conans/test/integration/diamond_test.py
+++ b/conans/test/integration/diamond_test.py
@@ -17,7 +17,7 @@ def setUp(self):
                                  [],  # write permissions
                                  users={"lasote": "mypass"})  # exported users and passwords
         self.servers = {"default": test_server}
-        self.conan = TestClient(servers=self.servers, users={"default":[("lasote", "mypass")]})
+        self.conan = TestClient(servers=self.servers, users={"default": [("lasote", "mypass")]})
 
     def _export_upload(self, name, version=None, deps=None):
         files = cpp_hello_conan_files(name, version, deps, need_patch=True)
@@ -34,6 +34,7 @@ def _check_individual_deps(self, client):
         cmakebuildinfo = load(os.path.join(client.current_folder, BUILD_INFO_CMAKE))
         self.assertIn("set(CONAN_LIBS helloHello3 helloHello1 helloHello2 helloHello0",
                       cmakebuildinfo)
+        self.assertIn("set(CONAN_DEPENDENCIES Hello3 Hello1 Hello2 Hello0)", cmakebuildinfo)
         deps_cpp_info = DepsCppInfo.loads(content)
         self.assertEqual(len(deps_cpp_info.include_paths), 4)
         for dep in ("Hello3", "Hello2", "Hello1", "Hello0"):
@@ -54,7 +55,7 @@ def reuse_test(self):
         self._export_upload("Hello3", "0.1", ["Hello1/0.1@lasote/stable",
                                               "Hello2/0.1@lasote/stable"])
 
-        client = TestClient(servers=self.servers, users={"default":[("lasote", "mypass")]})  # Mocked userio
+        client = TestClient(servers=self.servers, users={"default": [("lasote", "mypass")]})
         files3 = cpp_hello_conan_files("Hello4", "0.1", ["Hello3/0.1@lasote/stable"])
 
         # Add some stuff to base project conanfile to test further the individual
@@ -62,9 +63,9 @@ def reuse_test(self):
         content = files3[CONANFILE]
         content = content.replace("generators =", 'generators = "txt",')
         content = content.replace("def build(self):",
-                                            "def build(self):\n        "
-                                            "self.output.info('INCLUDE %s' "
-                                            "% self.deps_cpp_info['Hello0'].include_paths)")
+                                  "def build(self):\n"
+                                  "        self.output.info('INCLUDE %s' "
+                                  "% self.deps_cpp_info['Hello0'].include_paths)")
         files3[CONANFILE] = content
         client.save(files3)
 
@@ -98,7 +99,7 @@ def reuse_test(self):
         client.run("upload Hello0/0.1@lasote/stable --all")
         self.assertEqual(str(client.user_io.out).count("Uploading package"), 2)
 
-        client2 = TestClient(servers=self.servers, users={"default":[("lasote", "mypass")]})  # Mocked userio
+        client2 = TestClient(servers=self.servers, users={"default": [("lasote", "mypass")]})
         files3 = cpp_hello_conan_files("Hello4", "0.1", ["Hello3/0.1@lasote/stable"])
         client2.save(files3)
         client2.run("install . --build missing")