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_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)
$ 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:
$ 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?