1. 程式人生 > >openCV的cmake中配置QT5路徑

openCV的cmake中配置QT5路徑

執行cmake移植opencv時出錯,報錯資訊如下:

CMake Warning at cmake/OpenCVFindLibsGUI.cmake:18 (find_package):
  Could not find module FindQt5Core.cmake or a configuration file for package
  Qt5Core.

其中文翻譯是:

 cmake / OpenCVFindLibsGUI.cmake上的CMake警告:18(find_package):
  找不到模組FindQt5Core.cmake或包的配置檔案
 Qt5Core。

它給出的解決方法是把QT5中cmake的配置路徑新增到QT5_Core_DIR中;

  Adjust CMAKE_MODULE_PATH to find FindQt5Core.cmake or set Qt5Core_DIR to
the directory containing a CMake configuration file for Qt5Core.  The file
will have one of the following names:

  Qt5CoreConfig.cmake
  qt5core-config.cmake

使用命令在QT路徑下定位這兩個檔案,locate Qt5CoreConfig.cmake

,找到兩個目錄:
locate Qt5CoreConfig.cmake
進入/opt/Qt5.3.2/5.3/android_armv7/lib/cmake/目錄,QT5需要的配置路徑都在這個下面;
QT5配置路徑
依次將cmake中需要的路徑都填上;
再次configure,就沒有報錯了,用generte生成Makefile;