# how to find Qt for iOS?

**URL:** https://discourse.cmake.org/t/how-to-find-qt-for-ios/1061
**Category:** Usage
**Tags:** os:macos
**Created:** [April 20, 2020, 12:41pm UTC](https://discourse.cmake.org/t/how-to-find-qt-for-ios/1061 "2020-04-20T12:41:38Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![davemilter](https://discourse.cmake.org/user_avatar/discourse.cmake.org/davemilter/32/541_2.png) [@davemilter](https://discourse.cmake.org/u/davemilter)
#### Post date: [April 20, 2020, 12:41pm UTC](https://discourse.cmake.org/t/how-to-find-qt-for-ios/1061/1 "2020-04-20T12:41:38Z")

</div>

I want to compile project (which uses Qt) for iOS on Mac OS .

But `cmake` can not find Qt for iOS (the project compiled just fine for iOS on the same machine  
with `qmake`).

Here is my `CMakeLists.txt`:

```cmake
cmake_minimum_required(VERSION 3.5)
  
project(test3 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt5 COMPONENTS Core Quick REQUIRED)

```

```auto
$ cmake -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_PREFIX_PATH=/Users/user/Qt/5.14.1/ios ..
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (find_package):
  By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5" with any of
  the following names:

    Qt5Config.cmake
    qt5-config.cmake

  Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
  to a directory containing one of the above files. If "Qt5" provides a
  separate development package or SDK, be sure it has been installed.

-- Configuring incomplete, errors occurred!
See also "/Users/user/projects/study/qml/test3/build_ios2/CMakeFiles/CMakeOutput.log".

```

But Qt5Config.cmake obviously exists:

```auto
$ find /Users/user/Qt/5.14.1/ios -name Qt5Config.cmake
/Users/user/Qt/5.14.1/ios/lib/cmake/Qt5/Qt5Config.cmake

```

So how can I make `find_package(Qt5 COMPONENTS Core Quick REQUIRED)` happy,  
when I crosscompiled for iOS?

---

<div class="post-metadata">

### Author: ![MaySantucci](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/db5fbb/32.png) [@MaySantucci](https://discourse.cmake.org/u/MaySantucci)
#### Post date: [May 20, 2020, 8:35am UTC](https://discourse.cmake.org/t/how-to-find-qt-for-ios/1061/2 "2020-05-20T08:35:33Z")

</div>

To solve this problem you need to add this at the end of the cmake command

> -DQt5\_DIR=/Users/user/Qt/5.14.1/ios/lib/cmake/Qt5

Probably you need to do this for all the components that you have specify in the find\_package macro.
