We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[bug] Propagation of cpp_info.name in cmake_find_package_multi
The `cmake_find_package_multi` correctly generates *XXXConfig.cmake* files using the dependency's `cpp_info.name` for the `XXX` part, but doesn't always correctly use `cpp_info.name` inside the generated file.

### Environment Details
  * Operating System+version: Ubuntu 18.04
  * Conan version: 1.19.2
  * Python version: 3.6.8

### Steps to reproduce

I have got an ITK recipe that requires both `zlib` and `hdf5` and uses `cmake_find_package_multi`, the `hdf5` recipe also requires `zlib`. Everything worked smoothly up to yesterday when the `cpp_info.name` of `zlib` was changed to `ZLIB`: now `cmake_find_package_multi` correctly generates *HDF5Config.cmake* and *ZLIBConfig.cmake* as expected, but the *HDF5Config.cmake* file contains the following lines:

```cmake
include(CMakeFindDependencyMacro)
if(${CMAKE_VERSION} VERSION_LESS "3.9.0")
  find_package(zlib REQUIRED NO_MODULE)
else()
  find_dependency(zlib REQUIRED NO_MODULE)
endif()
get_target_property(tmp zlib::zlib INTERFACE_LINK_LIBRARIES)
```

When the `find_dependency` above is called, it searches a file called *zlibConfig.cmake* instead of the generated *ZLIBConfig.cmake*. I can't tell for sure, but I believe that `cmake_find_package_multi` doesn't correctly propagate the `cpp_info.name` in to the `find_dependency` and subsequent target names when it should.

### Logs (Executed commands with output) (Include/Attach if Applicable)

The relevant logs are the following ones:

```
CMake Error at /usr/share/cmake-3.10/Modules/CMakeFindDependencyMacro.cmake:48 (find_package):
  Could not find a package configuration file provided by "zlib" with any of
  the following names:

    zlibConfig.cmake
    zlib-config.cmake

  Add the installation prefix of "zlib" to CMAKE_PREFIX_PATH or set
  "zlib_DIR" to a directory containing one of the above files.  If "zlib"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  HDF5Config.cmake:43 (find_dependency)
  source_subfolder/Modules/ThirdParty/HDF5/itk-module-init.cmake:5 (find_package)
  source_subfolder/CMake/ITKModuleEnablement.cmake:318 (include)
  source_subfolder/CMakeLists.txt:433 (include)


-- Configuring incomplete, errors occurred!
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `conans/client/generators/cmake_find_package.py`
Content:
```
1 from conans.client.generators.cmake import DepsCppCmake
2 from conans.client.generators.cmake_find_package_common import target_template
3 from conans.model import Generator
4 
5 find_package_header = """
6 include(FindPackageHandleStandardArgs)
7 
8 message(STATUS "Conan: Using autogenerated Find{name}.cmake")
9 # Global approach
10 set({name}_FOUND 1)
11 set({name}_VERSION "{version}")
12 
13 find_package_handle_standard_args({name} REQUIRED_VARS {name}_VERSION VERSION_VAR {name}_VERSION)
14 mark_as_advanced({name}_FOUND {name}_VERSION)
15 
16 """
17 
18 
19 assign_target_properties = """
20     if({name}_INCLUDE_DIRS)
21       set_target_properties({name}::{name} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${{{name}_INCLUDE_DIRS}}")
22     endif()
23     set_property(TARGET {name}::{name} PROPERTY INTERFACE_LINK_LIBRARIES ${{{name}_LIBRARIES_TARGETS}} "${{{name}_LINKER_FLAGS_LIST}}")
24     set_property(TARGET {name}::{name} PROPERTY INTERFACE_COMPILE_DEFINITIONS ${{{name}_COMPILE_DEFINITIONS}})
25     set_property(TARGET {name}::{name} PROPERTY INTERFACE_COMPILE_OPTIONS "${{{name}_COMPILE_OPTIONS_LIST}}")
26 """
27 
28 
29 class CMakeFindPackageGenerator(Generator):
30     template = """
31 {find_package_header_block}
32 {find_libraries_block}
33 if(NOT ${{CMAKE_VERSION}} VERSION_LESS "3.0")
34     # Target approach
35     if(NOT TARGET {name}::{name})
36         add_library({name}::{name} INTERFACE IMPORTED)
37         {assign_target_properties_block}
38         {find_dependencies_block}
39     endif()
40 endif()
41 """
42 
43     @property
44     def filename(self):
45         pass
46 
47     @property
48     def content(self):
49         ret = {}
50         for depname, cpp_info in self.deps_build_info.dependencies:
51             ret["Find%s.cmake" % cpp_info.name] = self._find_for_dep(cpp_info.name, cpp_info)
52         return ret
53 
54     def _find_for_dep(self, name, cpp_info):
55         deps = DepsCppCmake(cpp_info)
56         lines = []
57         if cpp_info.public_deps:
58             # Here we are generating FindXXX, so find_modules=True
59             lines = find_dependency_lines(name, cpp_info, find_modules=True)
60         find_package_header_block = find_package_header.format(name=name, version=cpp_info.version)
61         find_libraries_block = target_template.format(name=name, deps=deps, build_type_suffix="")
62         target_props = assign_target_properties.format(name=name, deps=deps)
63         tmp = self.template.format(name=name, deps=deps,
64                                    version=cpp_info.version,
65                                    find_dependencies_block="\n".join(lines),
66                                    find_libraries_block=find_libraries_block,
67                                    find_package_header_block=find_package_header_block,
68                                    assign_target_properties_block=target_props)
69         return tmp
70 
71 
72 def find_dependency_lines(name, cpp_info, find_modules):
73     lines = ["", "# Library dependencies", "include(CMakeFindDependencyMacro)"]
74     for dep in cpp_info.public_deps:
75         def property_lines(prop):
76             lib_t = "%s::%s" % (name, name)
77             dep_t = "%s::%s" % (dep, dep)
78             return ["get_target_property(tmp %s %s)" % (dep_t, prop),
79                     "if(tmp)",
80                     "  set_property(TARGET %s APPEND PROPERTY %s ${tmp})" % (lib_t, prop),
81                     'endif()']
82 
83         if find_modules:
84             lines.append("find_dependency(%s REQUIRED)" % dep)
85         else:
86             # https://github.com/conan-io/conan/issues/4994
87             # https://github.com/conan-io/conan/issues/5040
88             lines.append('if(${CMAKE_VERSION} VERSION_LESS "3.9.0")')
89             lines.append('  find_package(%s REQUIRED NO_MODULE)' % dep)
90             lines.append("else()")
91             lines.append('  find_dependency(%s REQUIRED NO_MODULE)' % dep)
92             lines.append("endif()")
93 
94         lines.extend(property_lines("INTERFACE_LINK_LIBRARIES"))
95         lines.extend(property_lines("INTERFACE_COMPILE_DEFINITIONS"))
96         lines.extend(property_lines("INTERFACE_INCLUDE_DIRECTORIES"))
97     return ["    {}".format(l) for l in lines]
98
```

Path: `conans/client/generators/cmake_find_package_multi.py`
Content:
```
1 from conans.client.generators.cmake import DepsCppCmake
2 from conans.client.generators.cmake_find_package import find_dependency_lines
3 from conans.client.generators.cmake_find_package_common import target_template
4 from conans.model import Generator
5 
6 
7 class CMakeFindPackageMultiGenerator(Generator):
8     config_xxx_template = """
9 
10 # Requires CMake > 3.0
11 if(${{CMAKE_VERSION}} VERSION_LESS "3.0")
12    message(FATAL_ERROR "The 'cmake_find_package_multi' only works with CMake > 3.0" )
13 endif()
14 
15 include(${{CMAKE_CURRENT_LIST_DIR}}/{name}Targets.cmake)
16 
17 {target_props_block}
18 {find_dependencies_block}
19 """
20 
21     targets_file = """
22 if(NOT TARGET {name}::{name})
23     add_library({name}::{name} INTERFACE IMPORTED)
24 endif()
25 
26 # Load the debug and release library finders
27 get_filename_component(_DIR "${{CMAKE_CURRENT_LIST_FILE}}" PATH)
28 file(GLOB CONFIG_FILES "${{_DIR}}/{name}Target-*.cmake")
29 
30 foreach(f ${{CONFIG_FILES}})
31   include(${{f}})
32 endforeach()
33     
34 """
35 
36     target_properties = """
37 # Assign target properties
38 set_property(TARGET {name}::{name} 
39              PROPERTY INTERFACE_LINK_LIBRARIES 
40                  $<$<CONFIG:Release>:${{{name}_LIBRARIES_TARGETS_RELEASE}} ${{{name}_LINKER_FLAGS_RELEASE_LIST}}>
41                  $<$<CONFIG:RelWithDebInfo>:${{{name}_LIBRARIES_TARGETS_RELWITHDEBINFO}} ${{{name}_LINKER_FLAGS_RELWITHDEBINFO_LIST}}>
42                  $<$<CONFIG:MinSizeRel>:${{{name}_LIBRARIES_TARGETS_MINSIZEREL}} ${{{name}_LINKER_FLAGS_MINSIZEREL_LIST}}>
43                  $<$<CONFIG:Debug>:${{{name}_LIBRARIES_TARGETS_DEBUG}} ${{{name}_LINKER_FLAGS_DEBUG_LIST}}>)
44 set_property(TARGET {name}::{name} 
45              PROPERTY INTERFACE_INCLUDE_DIRECTORIES 
46                  $<$<CONFIG:Release>:${{{name}_INCLUDE_DIRS_RELEASE}}>
47                  $<$<CONFIG:RelWithDebInfo>:${{{name}_INCLUDE_DIRS_RELWITHDEBINFO}}>
48                  $<$<CONFIG:MinSizeRel>:${{{name}_INCLUDE_DIRS_MINSIZEREL}}>
49                  $<$<CONFIG:Debug>:${{{name}_INCLUDE_DIRS_DEBUG}}>)
50 set_property(TARGET {name}::{name} 
51              PROPERTY INTERFACE_COMPILE_DEFINITIONS 
52                  $<$<CONFIG:Release>:${{{name}_COMPILE_DEFINITIONS_RELEASE}}>
53                  $<$<CONFIG:RelWithDebInfo>:${{{name}_COMPILE_DEFINITIONS_RELWITHDEBINFO}}>
54                  $<$<CONFIG:MinSizeRel>:${{{name}_COMPILE_DEFINITIONS_MINSIZEREL}}>
55                  $<$<CONFIG:Debug>:${{{name}_COMPILE_DEFINITIONS_DEBUG}}>)
56 set_property(TARGET {name}::{name} 
57              PROPERTY INTERFACE_COMPILE_OPTIONS 
58                  $<$<CONFIG:Release>:${{{name}_COMPILE_OPTIONS_RELEASE_LIST}}>
59                  $<$<CONFIG:RelWithDebInfo>:${{{name}_COMPILE_OPTIONS_RELWITHDEBINFO_LIST}}>
60                  $<$<CONFIG:MinSizeRel>:${{{name}_COMPILE_OPTIONS_MINSIZEREL_LIST}}>
61                  $<$<CONFIG:Debug>:${{{name}_COMPILE_OPTIONS_DEBUG_LIST}}>) 
62     """
63 
64     @property
65     def filename(self):
66         pass
67 
68     @property
69     def content(self):
70         ret = {}
71         build_type = self.conanfile.settings.get_safe("build_type")
72         build_type_suffix = "_{}".format(build_type.upper()) if build_type else ""
73         for _, cpp_info in self.deps_build_info.dependencies:
74             depname = cpp_info.name
75             deps = DepsCppCmake(cpp_info)
76             ret["{}Config.cmake".format(depname)] = self._find_for_dep(depname, cpp_info)
77 
78             find_lib = target_template.format(name=depname, deps=deps,
79                                               build_type_suffix=build_type_suffix)
80             ret["{}Targets.cmake".format(depname)] = self.targets_file.format(name=depname)
81             ret["{}Target-{}.cmake".format(depname, build_type.lower())] = find_lib
82         return ret
83 
84     def _build_type_suffix(self, build_type):
85         return
86 
87     def _find_for_dep(self, name, cpp_info):
88         lines = []
89         if cpp_info.public_deps:
90             # Here we are generating only Config files, so do not search for FindXXX modules
91             lines = find_dependency_lines(name, cpp_info, find_modules=False)
92 
93         targets_props = self.target_properties.format(name=name)
94 
95         tmp = self.config_xxx_template.format(name=name,
96                                               version=cpp_info.version,
97                                               find_dependencies_block="\n".join(lines),
98                                               target_props_block=targets_props)
99 
100         return tmp
101
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/conans/client/generators/cmake_find_package.py b/conans/client/generators/cmake_find_package.py
--- a/conans/client/generators/cmake_find_package.py
+++ b/conans/client/generators/cmake_find_package.py
@@ -56,7 +56,8 @@
         lines = []
         if cpp_info.public_deps:
             # Here we are generating FindXXX, so find_modules=True
-            lines = find_dependency_lines(name, cpp_info, find_modules=True)
+            public_deps_names = [self.deps_build_info[dep].name for dep in cpp_info.public_deps]
+            lines = find_dependency_lines(name, public_deps_names, find_modules=True)
         find_package_header_block = find_package_header.format(name=name, version=cpp_info.version)
         find_libraries_block = target_template.format(name=name, deps=deps, build_type_suffix="")
         target_props = assign_target_properties.format(name=name, deps=deps)
@@ -69,26 +70,26 @@
         return tmp
 
 
-def find_dependency_lines(name, cpp_info, find_modules):
+def find_dependency_lines(name, public_deps_names, find_modules):
     lines = ["", "# Library dependencies", "include(CMakeFindDependencyMacro)"]
-    for dep in cpp_info.public_deps:
+    for dep_name in public_deps_names:
         def property_lines(prop):
             lib_t = "%s::%s" % (name, name)
-            dep_t = "%s::%s" % (dep, dep)
+            dep_t = "%s::%s" % (dep_name, dep_name)
             return ["get_target_property(tmp %s %s)" % (dep_t, prop),
                     "if(tmp)",
                     "  set_property(TARGET %s APPEND PROPERTY %s ${tmp})" % (lib_t, prop),
                     'endif()']
 
         if find_modules:
-            lines.append("find_dependency(%s REQUIRED)" % dep)
+            lines.append("find_dependency(%s REQUIRED)" % dep_name)
         else:
             # https://github.com/conan-io/conan/issues/4994
             # https://github.com/conan-io/conan/issues/5040
             lines.append('if(${CMAKE_VERSION} VERSION_LESS "3.9.0")')
-            lines.append('  find_package(%s REQUIRED NO_MODULE)' % dep)
+            lines.append('  find_package(%s REQUIRED NO_MODULE)' % dep_name)
             lines.append("else()")
-            lines.append('  find_dependency(%s REQUIRED NO_MODULE)' % dep)
+            lines.append('  find_dependency(%s REQUIRED NO_MODULE)' % dep_name)
             lines.append("endif()")
 
         lines.extend(property_lines("INTERFACE_LINK_LIBRARIES"))
diff --git a/conans/client/generators/cmake_find_package_multi.py b/conans/client/generators/cmake_find_package_multi.py
--- a/conans/client/generators/cmake_find_package_multi.py
+++ b/conans/client/generators/cmake_find_package_multi.py
@@ -88,7 +88,8 @@
         lines = []
         if cpp_info.public_deps:
             # Here we are generating only Config files, so do not search for FindXXX modules
-            lines = find_dependency_lines(name, cpp_info, find_modules=False)
+            public_deps_names = [self.deps_build_info[dep].name for dep in cpp_info.public_deps]
+            lines = find_dependency_lines(name, public_deps_names, find_modules=False)
 
         targets_props = self.target_properties.format(name=name)

{"golden_diff": "diff --git a/conans/client/generators/cmake_find_package.py b/conans/client/generators/cmake_find_package.py\n--- a/conans/client/generators/cmake_find_package.py\n+++ b/conans/client/generators/cmake_find_package.py\n@@ -56,7 +56,8 @@\n         lines = []\n         if cpp_info.public_deps:\n             # Here we are generating FindXXX, so find_modules=True\n-            lines = find_dependency_lines(name, cpp_info, find_modules=True)\n+            public_deps_names = [self.deps_build_info[dep].name for dep in cpp_info.public_deps]\n+            lines = find_dependency_lines(name, public_deps_names, find_modules=True)\n         find_package_header_block = find_package_header.format(name=name, version=cpp_info.version)\n         find_libraries_block = target_template.format(name=name, deps=deps, build_type_suffix=\"\")\n         target_props = assign_target_properties.format(name=name, deps=deps)\n@@ -69,26 +70,26 @@\n         return tmp\n \n \n-def find_dependency_lines(name, cpp_info, find_modules):\n+def find_dependency_lines(name, public_deps_names, find_modules):\n     lines = [\"\", \"# Library dependencies\", \"include(CMakeFindDependencyMacro)\"]\n-    for dep in cpp_info.public_deps:\n+    for dep_name in public_deps_names:\n         def property_lines(prop):\n             lib_t = \"%s::%s\" % (name, name)\n-            dep_t = \"%s::%s\" % (dep, dep)\n+            dep_t = \"%s::%s\" % (dep_name, dep_name)\n             return [\"get_target_property(tmp %s %s)\" % (dep_t, prop),\n                     \"if(tmp)\",\n                     \"  set_property(TARGET %s APPEND PROPERTY %s ${tmp})\" % (lib_t, prop),\n                     'endif()']\n \n         if find_modules:\n-            lines.append(\"find_dependency(%s REQUIRED)\" % dep)\n+            lines.append(\"find_dependency(%s REQUIRED)\" % dep_name)\n         else:\n             # https://github.com/conan-io/conan/issues/4994\n             # https://github.com/conan-io/conan/issues/5040\n             lines.append('if(${CMAKE_VERSION} VERSION_LESS \"3.9.0\")')\n-            lines.append('  find_package(%s REQUIRED NO_MODULE)' % dep)\n+            lines.append('  find_package(%s REQUIRED NO_MODULE)' % dep_name)\n             lines.append(\"else()\")\n-            lines.append('  find_dependency(%s REQUIRED NO_MODULE)' % dep)\n+            lines.append('  find_dependency(%s REQUIRED NO_MODULE)' % dep_name)\n             lines.append(\"endif()\")\n \n         lines.extend(property_lines(\"INTERFACE_LINK_LIBRARIES\"))\ndiff --git a/conans/client/generators/cmake_find_package_multi.py b/conans/client/generators/cmake_find_package_multi.py\n--- a/conans/client/generators/cmake_find_package_multi.py\n+++ b/conans/client/generators/cmake_find_package_multi.py\n@@ -88,7 +88,8 @@\n         lines = []\n         if cpp_info.public_deps:\n             # Here we are generating only Config files, so do not search for FindXXX modules\n-            lines = find_dependency_lines(name, cpp_info, find_modules=False)\n+            public_deps_names = [self.deps_build_info[dep].name for dep in cpp_info.public_deps]\n+            lines = find_dependency_lines(name, public_deps_names, find_modules=False)\n \n         targets_props = self.target_properties.format(name=name)\n", "issue": "[bug] Propagation of cpp_info.name in cmake_find_package_multi\nThe `cmake_find_package_multi` correctly generates *XXXConfig.cmake* files using the dependency's `cpp_info.name` for the `XXX` part, but doesn't always correctly use `cpp_info.name` inside the generated file.\r\n\r\n### Environment Details\r\n  * Operating System+version: Ubuntu 18.04\r\n  * Conan version: 1.19.2\r\n  * Python version: 3.6.8\r\n\r\n### Steps to reproduce\r\n\r\nI have got an ITK recipe that requires both `zlib` and `hdf5` and uses `cmake_find_package_multi`, the `hdf5` recipe also requires `zlib`. Everything worked smoothly up to yesterday when the `cpp_info.name` of `zlib` was changed to `ZLIB`: now `cmake_find_package_multi` correctly generates *HDF5Config.cmake* and *ZLIBConfig.cmake* as expected, but the *HDF5Config.cmake* file contains the following lines:\r\n\r\n```cmake\r\ninclude(CMakeFindDependencyMacro)\r\nif(${CMAKE_VERSION} VERSION_LESS \"3.9.0\")\r\n  find_package(zlib REQUIRED NO_MODULE)\r\nelse()\r\n  find_dependency(zlib REQUIRED NO_MODULE)\r\nendif()\r\nget_target_property(tmp zlib::zlib INTERFACE_LINK_LIBRARIES)\r\n```\r\n\r\nWhen the `find_dependency` above is called, it searches a file called *zlibConfig.cmake* instead of the generated *ZLIBConfig.cmake*. I can't tell for sure, but I believe that `cmake_find_package_multi` doesn't correctly propagate the `cpp_info.name` in to the `find_dependency` and subsequent target names when it should.\r\n\r\n### Logs (Executed commands with output) (Include/Attach if Applicable)\r\n\r\nThe relevant logs are the following ones:\r\n\r\n```\r\nCMake Error at /usr/share/cmake-3.10/Modules/CMakeFindDependencyMacro.cmake:48 (find_package):\r\n  Could not find a package configuration file provided by \"zlib\" with any of\r\n  the following names:\r\n\r\n    zlibConfig.cmake\r\n    zlib-config.cmake\r\n\r\n  Add the installation prefix of \"zlib\" to CMAKE_PREFIX_PATH or set\r\n  \"zlib_DIR\" to a directory containing one of the above files.  If \"zlib\"\r\n  provides a separate development package or SDK, be sure it has been\r\n  installed.\r\nCall Stack (most recent call first):\r\n  HDF5Config.cmake:43 (find_dependency)\r\n  source_subfolder/Modules/ThirdParty/HDF5/itk-module-init.cmake:5 (find_package)\r\n  source_subfolder/CMake/ITKModuleEnablement.cmake:318 (include)\r\n  source_subfolder/CMakeLists.txt:433 (include)\r\n\r\n\r\n-- Configuring incomplete, errors occurred!\r\n```\r\n\n", "before_files": [{"content": "from conans.client.generators.cmake import DepsCppCmake\nfrom conans.client.generators.cmake_find_package_common import target_template\nfrom conans.model import Generator\n\nfind_package_header = \"\"\"\ninclude(FindPackageHandleStandardArgs)\n\nmessage(STATUS \"Conan: Using autogenerated Find{name}.cmake\")\n# Global approach\nset({name}_FOUND 1)\nset({name}_VERSION \"{version}\")\n\nfind_package_handle_standard_args({name} REQUIRED_VARS {name}_VERSION VERSION_VAR {name}_VERSION)\nmark_as_advanced({name}_FOUND {name}_VERSION)\n\n\"\"\"\n\n\nassign_target_properties = \"\"\"\n    if({name}_INCLUDE_DIRS)\n      set_target_properties({name}::{name} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES \"${{{name}_INCLUDE_DIRS}}\")\n    endif()\n    set_property(TARGET {name}::{name} PROPERTY INTERFACE_LINK_LIBRARIES ${{{name}_LIBRARIES_TARGETS}} \"${{{name}_LINKER_FLAGS_LIST}}\")\n    set_property(TARGET {name}::{name} PROPERTY INTERFACE_COMPILE_DEFINITIONS ${{{name}_COMPILE_DEFINITIONS}})\n    set_property(TARGET {name}::{name} PROPERTY INTERFACE_COMPILE_OPTIONS \"${{{name}_COMPILE_OPTIONS_LIST}}\")\n\"\"\"\n\n\nclass CMakeFindPackageGenerator(Generator):\n    template = \"\"\"\n{find_package_header_block}\n{find_libraries_block}\nif(NOT ${{CMAKE_VERSION}} VERSION_LESS \"3.0\")\n    # Target approach\n    if(NOT TARGET {name}::{name})\n        add_library({name}::{name} INTERFACE IMPORTED)\n        {assign_target_properties_block}\n        {find_dependencies_block}\n    endif()\nendif()\n\"\"\"\n\n    @property\n    def filename(self):\n        pass\n\n    @property\n    def content(self):\n        ret = {}\n        for depname, cpp_info in self.deps_build_info.dependencies:\n            ret[\"Find%s.cmake\" % cpp_info.name] = self._find_for_dep(cpp_info.name, cpp_info)\n        return ret\n\n    def _find_for_dep(self, name, cpp_info):\n        deps = DepsCppCmake(cpp_info)\n        lines = []\n        if cpp_info.public_deps:\n            # Here we are generating FindXXX, so find_modules=True\n            lines = find_dependency_lines(name, cpp_info, find_modules=True)\n        find_package_header_block = find_package_header.format(name=name, version=cpp_info.version)\n        find_libraries_block = target_template.format(name=name, deps=deps, build_type_suffix=\"\")\n        target_props = assign_target_properties.format(name=name, deps=deps)\n        tmp = self.template.format(name=name, deps=deps,\n                                   version=cpp_info.version,\n                                   find_dependencies_block=\"\\n\".join(lines),\n                                   find_libraries_block=find_libraries_block,\n                                   find_package_header_block=find_package_header_block,\n                                   assign_target_properties_block=target_props)\n        return tmp\n\n\ndef find_dependency_lines(name, cpp_info, find_modules):\n    lines = [\"\", \"# Library dependencies\", \"include(CMakeFindDependencyMacro)\"]\n    for dep in cpp_info.public_deps:\n        def property_lines(prop):\n            lib_t = \"%s::%s\" % (name, name)\n            dep_t = \"%s::%s\" % (dep, dep)\n            return [\"get_target_property(tmp %s %s)\" % (dep_t, prop),\n                    \"if(tmp)\",\n                    \"  set_property(TARGET %s APPEND PROPERTY %s ${tmp})\" % (lib_t, prop),\n                    'endif()']\n\n        if find_modules:\n            lines.append(\"find_dependency(%s REQUIRED)\" % dep)\n        else:\n            # https://github.com/conan-io/conan/issues/4994\n            # https://github.com/conan-io/conan/issues/5040\n            lines.append('if(${CMAKE_VERSION} VERSION_LESS \"3.9.0\")')\n            lines.append('  find_package(%s REQUIRED NO_MODULE)' % dep)\n            lines.append(\"else()\")\n            lines.append('  find_dependency(%s REQUIRED NO_MODULE)' % dep)\n            lines.append(\"endif()\")\n\n        lines.extend(property_lines(\"INTERFACE_LINK_LIBRARIES\"))\n        lines.extend(property_lines(\"INTERFACE_COMPILE_DEFINITIONS\"))\n        lines.extend(property_lines(\"INTERFACE_INCLUDE_DIRECTORIES\"))\n    return [\"    {}\".format(l) for l in lines]\n", "path": "conans/client/generators/cmake_find_package.py"}, {"content": "from conans.client.generators.cmake import DepsCppCmake\nfrom conans.client.generators.cmake_find_package import find_dependency_lines\nfrom conans.client.generators.cmake_find_package_common import target_template\nfrom conans.model import Generator\n\n\nclass CMakeFindPackageMultiGenerator(Generator):\n    config_xxx_template = \"\"\"\n\n# Requires CMake > 3.0\nif(${{CMAKE_VERSION}} VERSION_LESS \"3.0\")\n   message(FATAL_ERROR \"The 'cmake_find_package_multi' only works with CMake > 3.0\" )\nendif()\n\ninclude(${{CMAKE_CURRENT_LIST_DIR}}/{name}Targets.cmake)\n\n{target_props_block}\n{find_dependencies_block}\n\"\"\"\n\n    targets_file = \"\"\"\nif(NOT TARGET {name}::{name})\n    add_library({name}::{name} INTERFACE IMPORTED)\nendif()\n\n# Load the debug and release library finders\nget_filename_component(_DIR \"${{CMAKE_CURRENT_LIST_FILE}}\" PATH)\nfile(GLOB CONFIG_FILES \"${{_DIR}}/{name}Target-*.cmake\")\n\nforeach(f ${{CONFIG_FILES}})\n  include(${{f}})\nendforeach()\n    \n\"\"\"\n\n    target_properties = \"\"\"\n# Assign target properties\nset_property(TARGET {name}::{name} \n             PROPERTY INTERFACE_LINK_LIBRARIES \n                 $<$<CONFIG:Release>:${{{name}_LIBRARIES_TARGETS_RELEASE}} ${{{name}_LINKER_FLAGS_RELEASE_LIST}}>\n                 $<$<CONFIG:RelWithDebInfo>:${{{name}_LIBRARIES_TARGETS_RELWITHDEBINFO}} ${{{name}_LINKER_FLAGS_RELWITHDEBINFO_LIST}}>\n                 $<$<CONFIG:MinSizeRel>:${{{name}_LIBRARIES_TARGETS_MINSIZEREL}} ${{{name}_LINKER_FLAGS_MINSIZEREL_LIST}}>\n                 $<$<CONFIG:Debug>:${{{name}_LIBRARIES_TARGETS_DEBUG}} ${{{name}_LINKER_FLAGS_DEBUG_LIST}}>)\nset_property(TARGET {name}::{name} \n             PROPERTY INTERFACE_INCLUDE_DIRECTORIES \n                 $<$<CONFIG:Release>:${{{name}_INCLUDE_DIRS_RELEASE}}>\n                 $<$<CONFIG:RelWithDebInfo>:${{{name}_INCLUDE_DIRS_RELWITHDEBINFO}}>\n                 $<$<CONFIG:MinSizeRel>:${{{name}_INCLUDE_DIRS_MINSIZEREL}}>\n                 $<$<CONFIG:Debug>:${{{name}_INCLUDE_DIRS_DEBUG}}>)\nset_property(TARGET {name}::{name} \n             PROPERTY INTERFACE_COMPILE_DEFINITIONS \n                 $<$<CONFIG:Release>:${{{name}_COMPILE_DEFINITIONS_RELEASE}}>\n                 $<$<CONFIG:RelWithDebInfo>:${{{name}_COMPILE_DEFINITIONS_RELWITHDEBINFO}}>\n                 $<$<CONFIG:MinSizeRel>:${{{name}_COMPILE_DEFINITIONS_MINSIZEREL}}>\n                 $<$<CONFIG:Debug>:${{{name}_COMPILE_DEFINITIONS_DEBUG}}>)\nset_property(TARGET {name}::{name} \n             PROPERTY INTERFACE_COMPILE_OPTIONS \n                 $<$<CONFIG:Release>:${{{name}_COMPILE_OPTIONS_RELEASE_LIST}}>\n                 $<$<CONFIG:RelWithDebInfo>:${{{name}_COMPILE_OPTIONS_RELWITHDEBINFO_LIST}}>\n                 $<$<CONFIG:MinSizeRel>:${{{name}_COMPILE_OPTIONS_MINSIZEREL_LIST}}>\n                 $<$<CONFIG:Debug>:${{{name}_COMPILE_OPTIONS_DEBUG_LIST}}>) \n    \"\"\"\n\n    @property\n    def filename(self):\n        pass\n\n    @property\n    def content(self):\n        ret = {}\n        build_type = self.conanfile.settings.get_safe(\"build_type\")\n        build_type_suffix = \"_{}\".format(build_type.upper()) if build_type else \"\"\n        for _, cpp_info in self.deps_build_info.dependencies:\n            depname = cpp_info.name\n            deps = DepsCppCmake(cpp_info)\n            ret[\"{}Config.cmake\".format(depname)] = self._find_for_dep(depname, cpp_info)\n\n            find_lib = target_template.format(name=depname, deps=deps,\n                                              build_type_suffix=build_type_suffix)\n            ret[\"{}Targets.cmake\".format(depname)] = self.targets_file.format(name=depname)\n            ret[\"{}Target-{}.cmake\".format(depname, build_type.lower())] = find_lib\n        return ret\n\n    def _build_type_suffix(self, build_type):\n        return\n\n    def _find_for_dep(self, name, cpp_info):\n        lines = []\n        if cpp_info.public_deps:\n            # Here we are generating only Config files, so do not search for FindXXX modules\n            lines = find_dependency_lines(name, cpp_info, find_modules=False)\n\n        targets_props = self.target_properties.format(name=name)\n\n        tmp = self.config_xxx_template.format(name=name,\n                                              version=cpp_info.version,\n                                              find_dependencies_block=\"\\n\".join(lines),\n                                              target_props_block=targets_props)\n\n        return tmp\n", "path": "conans/client/generators/cmake_find_package_multi.py"}], "after_files": [{"content": "from conans.client.generators.cmake import DepsCppCmake\nfrom conans.client.generators.cmake_find_package_common import target_template\nfrom conans.model import Generator\n\nfind_package_header = \"\"\"\ninclude(FindPackageHandleStandardArgs)\n\nmessage(STATUS \"Conan: Using autogenerated Find{name}.cmake\")\n# Global approach\nset({name}_FOUND 1)\nset({name}_VERSION \"{version}\")\n\nfind_package_handle_standard_args({name} REQUIRED_VARS {name}_VERSION VERSION_VAR {name}_VERSION)\nmark_as_advanced({name}_FOUND {name}_VERSION)\n\n\"\"\"\n\n\nassign_target_properties = \"\"\"\n    if({name}_INCLUDE_DIRS)\n      set_target_properties({name}::{name} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES \"${{{name}_INCLUDE_DIRS}}\")\n    endif()\n    set_property(TARGET {name}::{name} PROPERTY INTERFACE_LINK_LIBRARIES ${{{name}_LIBRARIES_TARGETS}} \"${{{name}_LINKER_FLAGS_LIST}}\")\n    set_property(TARGET {name}::{name} PROPERTY INTERFACE_COMPILE_DEFINITIONS ${{{name}_COMPILE_DEFINITIONS}})\n    set_property(TARGET {name}::{name} PROPERTY INTERFACE_COMPILE_OPTIONS \"${{{name}_COMPILE_OPTIONS_LIST}}\")\n\"\"\"\n\n\nclass CMakeFindPackageGenerator(Generator):\n    template = \"\"\"\n{find_package_header_block}\n{find_libraries_block}\nif(NOT ${{CMAKE_VERSION}} VERSION_LESS \"3.0\")\n    # Target approach\n    if(NOT TARGET {name}::{name})\n        add_library({name}::{name} INTERFACE IMPORTED)\n        {assign_target_properties_block}\n        {find_dependencies_block}\n    endif()\nendif()\n\"\"\"\n\n    @property\n    def filename(self):\n        pass\n\n    @property\n    def content(self):\n        ret = {}\n        for depname, cpp_info in self.deps_build_info.dependencies:\n            ret[\"Find%s.cmake\" % cpp_info.name] = self._find_for_dep(cpp_info.name, cpp_info)\n        return ret\n\n    def _find_for_dep(self, name, cpp_info):\n        deps = DepsCppCmake(cpp_info)\n        lines = []\n        if cpp_info.public_deps:\n            # Here we are generating FindXXX, so find_modules=True\n            public_deps_names = [self.deps_build_info[dep].name for dep in cpp_info.public_deps]\n            lines = find_dependency_lines(name, public_deps_names, find_modules=True)\n        find_package_header_block = find_package_header.format(name=name, version=cpp_info.version)\n        find_libraries_block = target_template.format(name=name, deps=deps, build_type_suffix=\"\")\n        target_props = assign_target_properties.format(name=name, deps=deps)\n        tmp = self.template.format(name=name, deps=deps,\n                                   version=cpp_info.version,\n                                   find_dependencies_block=\"\\n\".join(lines),\n                                   find_libraries_block=find_libraries_block,\n                                   find_package_header_block=find_package_header_block,\n                                   assign_target_properties_block=target_props)\n        return tmp\n\n\ndef find_dependency_lines(name, public_deps_names, find_modules):\n    lines = [\"\", \"# Library dependencies\", \"include(CMakeFindDependencyMacro)\"]\n    for dep_name in public_deps_names:\n        def property_lines(prop):\n            lib_t = \"%s::%s\" % (name, name)\n            dep_t = \"%s::%s\" % (dep_name, dep_name)\n            return [\"get_target_property(tmp %s %s)\" % (dep_t, prop),\n                    \"if(tmp)\",\n                    \"  set_property(TARGET %s APPEND PROPERTY %s ${tmp})\" % (lib_t, prop),\n                    'endif()']\n\n        if find_modules:\n            lines.append(\"find_dependency(%s REQUIRED)\" % dep_name)\n        else:\n            # https://github.com/conan-io/conan/issues/4994\n            # https://github.com/conan-io/conan/issues/5040\n            lines.append('if(${CMAKE_VERSION} VERSION_LESS \"3.9.0\")')\n            lines.append('  find_package(%s REQUIRED NO_MODULE)' % dep_name)\n            lines.append(\"else()\")\n            lines.append('  find_dependency(%s REQUIRED NO_MODULE)' % dep_name)\n            lines.append(\"endif()\")\n\n        lines.extend(property_lines(\"INTERFACE_LINK_LIBRARIES\"))\n        lines.extend(property_lines(\"INTERFACE_COMPILE_DEFINITIONS\"))\n        lines.extend(property_lines(\"INTERFACE_INCLUDE_DIRECTORIES\"))\n    return [\"    {}\".format(l) for l in lines]\n", "path": "conans/client/generators/cmake_find_package.py"}, {"content": "from conans.client.generators.cmake import DepsCppCmake\nfrom conans.client.generators.cmake_find_package import find_dependency_lines\nfrom conans.client.generators.cmake_find_package_common import target_template\nfrom conans.model import Generator\n\n\nclass CMakeFindPackageMultiGenerator(Generator):\n    config_xxx_template = \"\"\"\n\n# Requires CMake > 3.0\nif(${{CMAKE_VERSION}} VERSION_LESS \"3.0\")\n   message(FATAL_ERROR \"The 'cmake_find_package_multi' only works with CMake > 3.0\" )\nendif()\n\ninclude(${{CMAKE_CURRENT_LIST_DIR}}/{name}Targets.cmake)\n\n{target_props_block}\n{find_dependencies_block}\n\"\"\"\n\n    targets_file = \"\"\"\nif(NOT TARGET {name}::{name})\n    add_library({name}::{name} INTERFACE IMPORTED)\nendif()\n\n# Load the debug and release library finders\nget_filename_component(_DIR \"${{CMAKE_CURRENT_LIST_FILE}}\" PATH)\nfile(GLOB CONFIG_FILES \"${{_DIR}}/{name}Target-*.cmake\")\n\nforeach(f ${{CONFIG_FILES}})\n  include(${{f}})\nendforeach()\n    \n\"\"\"\n\n    target_properties = \"\"\"\n# Assign target properties\nset_property(TARGET {name}::{name} \n             PROPERTY INTERFACE_LINK_LIBRARIES \n                 $<$<CONFIG:Release>:${{{name}_LIBRARIES_TARGETS_RELEASE}} ${{{name}_LINKER_FLAGS_RELEASE_LIST}}>\n                 $<$<CONFIG:RelWithDebInfo>:${{{name}_LIBRARIES_TARGETS_RELWITHDEBINFO}} ${{{name}_LINKER_FLAGS_RELWITHDEBINFO_LIST}}>\n                 $<$<CONFIG:MinSizeRel>:${{{name}_LIBRARIES_TARGETS_MINSIZEREL}} ${{{name}_LINKER_FLAGS_MINSIZEREL_LIST}}>\n                 $<$<CONFIG:Debug>:${{{name}_LIBRARIES_TARGETS_DEBUG}} ${{{name}_LINKER_FLAGS_DEBUG_LIST}}>)\nset_property(TARGET {name}::{name} \n             PROPERTY INTERFACE_INCLUDE_DIRECTORIES \n                 $<$<CONFIG:Release>:${{{name}_INCLUDE_DIRS_RELEASE}}>\n                 $<$<CONFIG:RelWithDebInfo>:${{{name}_INCLUDE_DIRS_RELWITHDEBINFO}}>\n                 $<$<CONFIG:MinSizeRel>:${{{name}_INCLUDE_DIRS_MINSIZEREL}}>\n                 $<$<CONFIG:Debug>:${{{name}_INCLUDE_DIRS_DEBUG}}>)\nset_property(TARGET {name}::{name} \n             PROPERTY INTERFACE_COMPILE_DEFINITIONS \n                 $<$<CONFIG:Release>:${{{name}_COMPILE_DEFINITIONS_RELEASE}}>\n                 $<$<CONFIG:RelWithDebInfo>:${{{name}_COMPILE_DEFINITIONS_RELWITHDEBINFO}}>\n                 $<$<CONFIG:MinSizeRel>:${{{name}_COMPILE_DEFINITIONS_MINSIZEREL}}>\n                 $<$<CONFIG:Debug>:${{{name}_COMPILE_DEFINITIONS_DEBUG}}>)\nset_property(TARGET {name}::{name} \n             PROPERTY INTERFACE_COMPILE_OPTIONS \n                 $<$<CONFIG:Release>:${{{name}_COMPILE_OPTIONS_RELEASE_LIST}}>\n                 $<$<CONFIG:RelWithDebInfo>:${{{name}_COMPILE_OPTIONS_RELWITHDEBINFO_LIST}}>\n                 $<$<CONFIG:MinSizeRel>:${{{name}_COMPILE_OPTIONS_MINSIZEREL_LIST}}>\n                 $<$<CONFIG:Debug>:${{{name}_COMPILE_OPTIONS_DEBUG_LIST}}>) \n    \"\"\"\n\n    @property\n    def filename(self):\n        pass\n\n    @property\n    def content(self):\n        ret = {}\n        build_type = self.conanfile.settings.get_safe(\"build_type\")\n        build_type_suffix = \"_{}\".format(build_type.upper()) if build_type else \"\"\n        for _, cpp_info in self.deps_build_info.dependencies:\n            depname = cpp_info.name\n            deps = DepsCppCmake(cpp_info)\n            ret[\"{}Config.cmake\".format(depname)] = self._find_for_dep(depname, cpp_info)\n\n            find_lib = target_template.format(name=depname, deps=deps,\n                                              build_type_suffix=build_type_suffix)\n            ret[\"{}Targets.cmake\".format(depname)] = self.targets_file.format(name=depname)\n            ret[\"{}Target-{}.cmake\".format(depname, build_type.lower())] = find_lib\n        return ret\n\n    def _build_type_suffix(self, build_type):\n        return\n\n    def _find_for_dep(self, name, cpp_info):\n        lines = []\n        if cpp_info.public_deps:\n            # Here we are generating only Config files, so do not search for FindXXX modules\n            public_deps_names = [self.deps_build_info[dep].name for dep in cpp_info.public_deps]\n            lines = find_dependency_lines(name, public_deps_names, find_modules=False)\n\n        targets_props = self.target_properties.format(name=name)\n\n        tmp = self.config_xxx_template.format(name=name,\n                                              version=cpp_info.version,\n                                              find_dependencies_block=\"\\n\".join(lines),\n                                              target_props_block=targets_props)\n\n        return tmp\n", "path": "conans/client/generators/cmake_find_package_multi.py"}]}