Repository: conan-io/conan-center-index

Issue:
[package] qt/5.15.2: multiconfiguration removes required component requirements
### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **qt/5.15.2**
  * Operating System+version: **macOS 12.2.1**
  * Compiler+version: **Apple clang 13.0.0**
  * Docker image: **None**
  * Conan version: **conan 1.45.0**
  * Python version: **Python 3.9.10**


### Conan profile
```
[settings]
os=Macos
os_build=Macos
arch=x86_64
arch_build=x86_64
compiler=apple-clang
compiler.version=13.0
compiler.libcxx=libc++
build_type=Release
[options]
[conf]
[build_requires]
[env]
```


### Steps to reproduce

(As example, this just includes doubleconversion, which demonstrates the problem quickly.)

```
conan create . 5.15.2@rnapier/xcode13 -k --build=missing \
	-o qt:with_mysql=False \
	-o qt:with_pq=False \
	-o qt:with_zstd=False \
	-o qt:with_sqlite3=False \
	-o qt:with_odbc=False \
	-o qt:with_libpng=False \
	-o qt:with_libjpeg=False \
	-o qt:openssl=False \
	-o qt:with_freetype=False \
	-o qt:multiconfiguration=True   # <=== 
```

### Logs

```
ERROR:
	ConanException: qt/5.15.2@rnapier/xcode13 package_info(): Package require 'double-conversion' declared in components requires but not defined as a recipe requirement
```

### Cause

Several requirements are removed if multiconfiguration is enabled:

```python
        if self.options.with_doubleconversion and not self.options.multiconfiguration:
            self.requires("double-conversion/3.2.0")
        if self.options.get_safe("with_freetype", False) and not self.options.multiconfiguration:
            self.requires("freetype/2.11.1")
        ...
        if self.options.get_safe("with_harfbuzz", False) and not self.options.multiconfiguration:
            self.requires("harfbuzz/3.2.0")
        if self.options.get_safe("with_libjpeg", False) and not self.options.multiconfiguration:
            if self.options.with_libjpeg == "libjpeg-turbo":
                self.requires("libjpeg-turbo/2.1.2")
            else:
                self.requires("libjpeg/9d")
        if self.options.get_safe("with_libpng", False) and not self.options.multiconfiguration:
            self.requires("libpng/1.6.37")
        if self.options.with_sqlite3 and not self.options.multiconfiguration:
            self.requires("sqlite3/3.37.2")
```

Just removing the `and not self.options.multiconfiguration` allows the build to complete, but I'm not certain why these were added in the first place (and why only on certain requirements).

I'll create a PR that removes the conditional unless there's a better solution.
[package] qt/5.15.2: multiconfiguration removes required component requirements
### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **qt/5.15.2**
  * Operating System+version: **macOS 12.2.1**
  * Compiler+version: **Apple clang 13.0.0**
  * Docker image: **None**
  * Conan version: **conan 1.45.0**
  * Python version: **Python 3.9.10**


### Conan profile
```
[settings]
os=Macos
os_build=Macos
arch=x86_64
arch_build=x86_64
compiler=apple-clang
compiler.version=13.0
compiler.libcxx=libc++
build_type=Release
[options]
[conf]
[build_requires]
[env]
```


### Steps to reproduce

(As example, this just includes doubleconversion, which demonstrates the problem quickly.)

```
conan create . 5.15.2@rnapier/xcode13 -k --build=missing \
	-o qt:with_mysql=False \
	-o qt:with_pq=False \
	-o qt:with_zstd=False \
	-o qt:with_sqlite3=False \
	-o qt:with_odbc=False \
	-o qt:with_libpng=False \
	-o qt:with_libjpeg=False \
	-o qt:openssl=False \
	-o qt:with_freetype=False \
	-o qt:multiconfiguration=True   # <=== 
```

### Logs

```
ERROR:
	ConanException: qt/5.15.2@rnapier/xcode13 package_info(): Package require 'double-conversion' declared in components requires but not defined as a recipe requirement
```

### Cause

Several requirements are removed if multiconfiguration is enabled:

```python
        if self.options.with_doubleconversion and not self.options.multiconfiguration:
            self.requires("double-conversion/3.2.0")
        if self.options.get_safe("with_freetype", False) and not self.options.multiconfiguration:
            self.requires("freetype/2.11.1")
        ...
        if self.options.get_safe("with_harfbuzz", False) and not self.options.multiconfiguration:
            self.requires("harfbuzz/3.2.0")
        if self.options.get_safe("with_libjpeg", False) and not self.options.multiconfiguration:
            if self.options.with_libjpeg == "libjpeg-turbo":
                self.requires("libjpeg-turbo/2.1.2")
            else:
                self.requires("libjpeg/9d")
        if self.options.get_safe("with_libpng", False) and not self.options.multiconfiguration:
            self.requires("libpng/1.6.37")
        if self.options.with_sqlite3 and not self.options.multiconfiguration:
            self.requires("sqlite3/3.37.2")
```

Just removing the `and not self.options.multiconfiguration` allows the build to complete, but I'm not certain why these were added in the first place (and why only on certain requirements).

I'll create a PR that removes the conditional unless there's a better solution.


Discussion:

Resolving patch:
diff --git a/recipes/qt/5.x.x/conanfile.py b/recipes/qt/5.x.x/conanfile.py
--- a/recipes/qt/5.x.x/conanfile.py
+++ b/recipes/qt/5.x.x/conanfile.py
@@ -335,24 +335,24 @@ def requirements(self):
             self.requires("glib/2.70.1")
         # if self.options.with_libiconv: # QTBUG-84708
         #     self.requires("libiconv/1.16")# QTBUG-84708
-        if self.options.with_doubleconversion and not self.options.multiconfiguration:
+        if self.options.with_doubleconversion:
             self.requires("double-conversion/3.2.0")
-        if self.options.get_safe("with_freetype", False) and not self.options.multiconfiguration:
+        if self.options.get_safe("with_freetype", False):
             self.requires("freetype/2.11.1")
         if self.options.get_safe("with_fontconfig", False):
             self.requires("fontconfig/2.13.93")
         if self.options.get_safe("with_icu", False):
             self.requires("icu/70.1")
-        if self.options.get_safe("with_harfbuzz", False) and not self.options.multiconfiguration:
+        if self.options.get_safe("with_harfbuzz", False):
             self.requires("harfbuzz/3.2.0")
-        if self.options.get_safe("with_libjpeg", False) and not self.options.multiconfiguration:
+        if self.options.get_safe("with_libjpeg", False):
             if self.options.with_libjpeg == "libjpeg-turbo":
                 self.requires("libjpeg-turbo/2.1.2")
             else:
                 self.requires("libjpeg/9d")
-        if self.options.get_safe("with_libpng", False) and not self.options.multiconfiguration:
+        if self.options.get_safe("with_libpng", False):
             self.requires("libpng/1.6.37")
-        if self.options.with_sqlite3 and not self.options.multiconfiguration:
+        if self.options.with_sqlite3:
             self.requires("sqlite3/3.37.2")
             self.options["sqlite3"].enable_column_metadata = True
         if self.options.get_safe("with_mysql", False):
@@ -858,11 +858,12 @@ def package_info(self):
         build_modules = []
 
         libsuffix = ""
-        if self.settings.build_type == "Debug":
-            if self.settings.os == "Windows":
-                libsuffix = "d"
-            elif tools.is_apple_os(self.settings.os):
-                libsuffix = "_debug"
+        if not self.options.multiconfiguration:
+            if self.settings.build_type == "Debug":
+                if self.settings.os == "Windows":
+                    libsuffix = "d"
+                elif tools.is_apple_os(self.settings.os):
+                    libsuffix = "_debug"
 
         def _get_corrected_reqs(requires):
             reqs = []


Test patch: