Repository: conan-io/conan-center-index

Issue:
[package] ms-gsl/3.1.0: CMakeDeps + Conan 1.42 uses incorrect name for CMake configs
<!-- 
  Please don't forget to update the issue title.
  Include all applicable information to help us reproduce your problem.
-->

### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **ms-gsl/3.1.0**
  * Operating System+version: **Fedora Silverblue 35**
  * Compiler+version: **GCC 11**
  * Conan version: **conan 1.42.0**
  * Python version: **Python 3.10.0**


### Conan profile (output of `conan profile show default` or `conan profile show <profile>` if custom profile is in use)
```
[settings]
os=Linux
arch=x86_64
compiler=gcc
compiler.version=11
compiler.libcxx=libstdc++11
compiler.cppstd=17
build_type=Debug
[options]
[conf]
[build_requires]
[env]
```


### Steps to reproduce (Include if Applicable)

Use the `CMakeToolchain` / `CMakeDeps` generator for a project and add `ms-gsl` as a `requires`.
In your `CMakeLists.txt` use `find_package(Microsoft.GSL REQUIRED)` and it will not be found during CMake's configure stage.
This is because the package is now named `ms-gsl` instead, which is unexpected.

### Logs (Include/Attach if Applicable)
<details><summary>Click to expand log</summary>

```
-- Conan: Target declared 'fmt::fmt'
CMake Error at Module/Components/Platform/CMakeLists.txt:8 (find_package):
  By not providing "FindMicrosoft.GSL.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "Microsoft.GSL", but CMake did not find one.

  Could not find a package configuration file provided by "Microsoft.GSL"
  with any of the following names:

    Microsoft.GSLConfig.cmake
    microsoft.gsl-config.cmake

  Add the installation prefix of "Microsoft.GSL" to CMAKE_PREFIX_PATH or set
  "Microsoft.GSL_DIR" to a directory containing one of the above files.  If
  "Microsoft.GSL" provides a separate development package or SDK, be sure it
  has been installed.


-- Configuring incomplete, errors occurred!
```

</details>



Discussion:

Resolving patch:
diff --git a/recipes/ms-gsl/all/conanfile.py b/recipes/ms-gsl/all/conanfile.py
--- a/recipes/ms-gsl/all/conanfile.py
+++ b/recipes/ms-gsl/all/conanfile.py
@@ -2,6 +2,9 @@
 from conans import ConanFile, tools
 from conans.errors import ConanInvalidConfiguration
 
+required_conan_version = ">=1.36.0"
+
+
 class MicrosoftGslConan(ConanFile):
     name = "ms-gsl"
     description = "Microsoft implementation of the Guidelines Support Library"
@@ -66,10 +69,9 @@ def package(self):
         self.copy(pattern="*", dst="include", src=os.path.join(self._source_subfolder, "include"))
 
     def package_info(self):
-        self.cpp_info.names["cmake_find_package"] = "Microsoft.GSL"
-        self.cpp_info.names["cmake_find_package_multi"] = "Microsoft.GSL"
-        self.cpp_info.components["_ms-gsl"].names["cmake_find_package"] = "GSL"
-        self.cpp_info.components["_ms-gsl"].names["cmake_find_package_multi"] = "GSL"
+        self.cpp_info.set_property("cmake_file_name", "Microsoft.GSL")
+        self.cpp_info.set_property("cmake_target_name", "Microsoft.GSL")
+        self.cpp_info.components["_ms-gsl"].set_property("cmake_target_name", "GSL")
         if tools.Version(self.version) < "3.0.0":
             self.cpp_info.components["_ms-gsl"].defines = [
                 self._contract_map[str(self.options.on_contract_violation)]


Test patch: