VLC-QT交叉编译时遇到Could not find a package configuration file provided by "Qt5Core"问题解决方法

最近在移植VLC-QT时自己编译源码时遇到如下问题:

CMake Error at config/Dependencies.cmake:28 (FIND_PACKAGE):
  By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Core", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Core"
  (requested version 5.2.0) with any of the following names:

    Qt5CoreConfig.cmake
    qt5core-config.cmake

  Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
  "Qt5Core_DIR" to a directory containing one of the above files.  If
  "Qt5Core" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):

  CMakeLists.txt:51 (INCLUDE)

-- Configuring incomplete, errors occurred!

经过各种资料搜索结合各种说法最终找到如下解决方法,按照QT官网所描述的最简单方式就是添加CMAKE_PREFIX_PATH。原文如下:

The easiest way to use CMake is to set the CMAKE_PREFIX_PATH environment variable to the install prefix of Qt 5

http://doc.qt.io/qt-5/cmake-manual.html

1、打开vlc-qt源码目录下的CMakeLists.txt

2、在SET(PROJECT_DESCRIPTION "VLC-Qt - Qt bindings for libVLC")下方添加一行

    SET(CMAKE_PREFIX_PATH /opt/Qt5.6.2/5.6/gcc_64)

注意一点的是CMAKE_PREFIX_PATH的目录的指向必须是在包含有bin lib include等这些QT的安装目录。





你可能感兴趣的:(QT开发)