Repository: conan-io/conan-center-index

Issue:
[package] qt/5.15.6: cmake configure error for iOS related to Qt5PrintSupport
### Description

_Please don't forget to update the issue title._

Missing profile or a short log will make extremely difficult to investigate your case or provide any help,
please, include all applicable information with details to help us reproduce your problem.


### Package and Environment Details

* Package Name/Version: **qt/5.15.6**
* Operating System+version: **macOS 12.6**
* Compiler+version: **Apple clang 13**
* Conan version: **conan 1.53.0**
* Python version: **Python 3.10.6**


### Conan profile

**build**:
[settings]
os=Macos
os_build=Macos
arch=x86_64
arch_build=x86_64
compiler=apple-clang
compiler.version=13
compiler.libcxx=libc++
build_type=Release
[options]
[conf]
tools.cmake.cmaketoolchain:generator=Ninja
[build_requires]
[env]

**host**:
[settings]
os=iOS
os.version=12.0
os.sdk=iphoneos
arch=armv8
compiler=apple-clang
compiler.version=13
compiler.libcxx=libc++
build_type=Release
[options]
[conf]
[build_requires]
[env]

### Steps to reproduce

1. built Qt for iOS
2. try to use it in CMake project

### Logs

<details><summary>Related CMake configure output</summary>

```
-- Conan: Component target declared 'Qt5::Core'
-- Conan: Component target declared 'Qt5::Gui'
-- Conan: Component target declared 'Qt5::EventDispatcherSupport'
-- Conan: Component target declared 'Qt5::FontDatabaseSupport'
-- Conan: Component target declared 'Qt5::ThemeSupport'
-- Conan: Component target declared 'Qt5::AccessibilitySupport'
-- Conan: Component target declared 'Qt5::ClipboardSupport'
-- Conan: Component target declared 'Qt5::GraphicsSupport'
-- Conan: Component target declared 'Qt5::QIOSIntegrationPlugin'
-- Conan: Component target declared 'qt::QIOSIntegrationPlugin'
-- Conan: Component target declared 'Qt5::QSQLiteDriverPlugin'
-- Conan: Component target declared 'Qt5::Network'
-- Conan: Component target declared 'Qt5::Sql'
-- Conan: Component target declared 'Qt5::Test'
-- Conan: Component target declared 'Qt5::Widgets'
-- Conan: Component target declared 'Qt5::PrintSupport'
-- Conan: Component target declared 'Qt5::OpenGL'
-- Conan: Component target declared 'Qt5::OpenGLExtensions'
-- Conan: Component target declared 'Qt5::Concurrent'
-- Conan: Component target declared 'Qt5::Xml'
-- Conan: Component target declared 'Qt5::LinguistTools'
-- Conan: Component target declared 'Qt5::UiPlugin'
-- Conan: Component target declared 'Qt5::UiTools'
-- Conan: Component target declared 'Qt5::Help'
-- Conan: Target declared 'qt::qt'
CMake Error at conan-generated/cmakedeps_macros.cmake:39 (message):
  Library 'Qt5PrintSupport' not found in package.  If 'Qt5PrintSupport' is a
  system library, declare it with 'cpp_info.system_libs' property
Call Stack (most recent call first):
  conan-generated/Qt5-Target-release.cmake:34 (conan_package_library_targets)
  conan-generated/Qt5Targets.cmake:26 (include)
  conan-generated/Qt5Config.cmake:10 (include)
  CMakeLists.txt:319 (find_package)
```

</details>

<details><summary>Conan configuration of Qt</summary>

```
class MyApp(ConanFile):
    settings = "os", "compiler", "build_type", "arch"
    generators = "CMakeDeps", "CMakeToolchain"
    requires = [
        "qt/5.15.6",
    ]
    default_options = {
        "qt/*:config": "-no-gif -no-ico -no-feature-imageformat_bmp -no-feature-imageformat_jpeg -no-feature-imageformat_ppm -no-feature-imageformat_xbm",
        "qt/*:opengl": "es2",
        "qt/*:openssl": False,
        "qt/*:qttools": True,
        "qt/*:with_freetype": False,
        "qt/*:with_libjpeg": False,
        "qt/*:with_md4c": False,
        "qt/*:with_mysql": False,
        "qt/*:with_odbc": False,
        "qt/*:with_openal": False,
        "qt/*:with_pq": False,
    }

    def requirements(self):
        self.requires("libpng/1.6.38", override=True)
```

</details>

There's no such library indeed:
```
> ll ~/.conan/data/qt/5.15.6/_/_/package/fd96a24743199f7a8a8e0f848b9ddeb83840f142/lib/libQt5Pr*
fish: No matches for wildcard '~/.conan/data/qt/5.15.6/_/_/package/fd96a24743199f7a8a8e0f848b9ddeb83840f142/lib/libQt5Pr*'. See `help wildcards-globbing`.
```

Its absence is correct: I also don't have it in my self-built Qt for iOS.


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
@@ -1138,7 +1138,7 @@ def _create_plugin(pluginname, libname, plugintype, requires):
             build_modules.append(self._cmake_qt5_private_file("Widgets"))
             self.cpp_info.components["qtWidgets"].build_modules["cmake_find_package"].append(self._cmake_qt5_private_file("Widgets"))
             self.cpp_info.components["qtWidgets"].build_modules["cmake_find_package_multi"].append(self._cmake_qt5_private_file("Widgets"))
-        if self.options.gui and self.options.widgets:
+        if self.options.gui and self.options.widgets and not self.settings.os in ["iOS", "watchOS", "tvOS"]:
             _create_module("PrintSupport", ["Gui", "Widgets"])
         if self.options.get_safe("opengl", "no") != "no" and self.options.gui:
             _create_module("OpenGL", ["Gui"])


Test patch: