У меня есть проект Cmake
, который без проблем работает в QtCreator
. При запуске того же проекта вне QtCreator (т.е. cmake ..
) я получаю:
MacBook-Pro-de-Hector-2:build hectoresteban$ cmake ..
CMake Error at CMakeLists.txt:31 (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.
Мой исходный CMakeFile
:
cmake_minimum_required(VERSION 3.5)
project(trial LANGUAGES C CXX)
set(ANDROID_NDK_ROOT "/Users/hectoresteban/Documents/C++/Qt/android-ndk-r21d")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt5 COMPONENTS Core Widgets LinguistTools REQUIRED)
Что в QtCreator
при сборке с использованием
Running /usr/local/Cellar/cmake/3.17.3/bin/cmake '-GUnix Makefiles' /Users/hectoresteban/Documents/C++/Qt/trial in /Users/hectoresteban/Documents/C++/Qt/build-trial-Desktop_x86_darwin_generic_mach_o_64bit-Debug.
работает нормально. Чтобы построить с терминала, я пытался сделать:
set(CMAKE_PREFIX_PATH "/Users/hectoresteban/Qt")
, но все еще та же проблема. Моя папка /Users/hectoresteban/Qt
выглядит так: