我有一个 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
文件夹的样子。
通常情况下,这些 5.x.x
目录应包含一个 lib/cmake
目录.设置 CMAKE_PREFIX_PATH
对此。