用CMake编译opencv3.1.0 按照
Win10+QT5.7.1搭建opencv开发环境
http://www.cnblogs.com/TooyLee/p/6438070.html
CMake配置过程中出现如下错误:
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".
CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
解决方案如下:
将CMAKE_MAKE_PROGRAM项后面的路径设置为:D:\qt\Qt5.6.2\Tools\mingw492_32\bin\mingw32-make.exe,
其他配置参照
Win7下qt5.3.1+opencv2.4.9编译环境的搭建
我们还需要把QT加上,找到WITH,把它下面的WITH_QT和WITH_OPENGL选上,再次Configure。这时会出现类似下面的错误提示:
CMake Error atC:/CMake/share/cmake-3.0/Modules/FindQt4.cmake:1316 (message):
Found unsuitable Qt version "" from NOTFOUND, this coderequires Qt 4.x
Call Stack (most recent call first):
cmake/OpenCVFindLibsGUI.cmake:34 (find_package)
CMakeLists.txt:466 (include)
找到QT_QMAKE_EXECUTABLE,它的值填写为:C:/Qt/Qt5.3.1/5.3/mingw482_32/bin/qmake.exe
找到QT_MKSPECS_DIR,它的值填写为:C:/Qt/Qt5.3.1/5.3/mingw482_32/mkspecs
找到QT_QTCORE_LIBRARY_DEBUG,它的值填写为:C:/Qt/Qt5.3.1/5.3/mingw482_32/bin/Qt5Cored.dll
找到QT_QTCORE_LIBRARY_RELEASE,它的值填写为C:/Qt/Qt5.3.1/5.3/mingw482_32/bin/Qt5Core.dll
找到QT_QTCORE_INCLUDE_DIR,它的值填写为C:/Qt/Qt5.3.1/5.3/mingw482_32/include/QtCore/5.3.1/QtCore
再次点击Configure,这时会出现类似下面的错误提示:
CMake Error atC:/CMake/share/cmake-3.0/Modules/FindQt4.cmake:1316 (message):
Found unsuitable Qt version "5.3.1" from
C:/Qt/Qt5.3.1/5.3/mingw482_32/bin/qmake.exe, this code requires Qt 4.x
Call Stack (most recent call first):
cmake/OpenCVFindLibsGUI.cmake:34 (find_package)
CMakeLists.txt:466 (include)
在Ungrouped Entries下找到Qt5Concurrent_DIR,Qt5Core_DIR,Qt5Gui_DIR,Qt5Test_DIR,Qt5Widgets_DIR,Qt5OpenGL_DIR,它们的Value分别填写为:
C:/Qt/Qt5.3.1/5.3/mingw482_32/lib/cmake/Qt5Concurrent
C:/Qt/Qt5.3.1/5.3/mingw482_32/lib/cmake/Qt5Core
C:/Qt/Qt5.3.1/5.3/mingw482_32/lib/cmake/Qt5Gui
C:/Qt/Qt5.3.1/5.3/mingw482_32/lib/cmake/Qt5Test
C:/Qt/Qt5.3.1/5.3/mingw482_32/lib/cmake/Qt5Widgets
C:/Qt/Qt5.3.1/5.3/mingw482_32/lib/cmake/Qt5OpenGL
再次Configure,这时配置完成,不会出现任何错误提示。虽然会有许多警告,如This warning is for project developers. Use -Wno-dev to suppress it.,但不用去管,按Generate。Generate完成后,关闭CMake窗口。
最后成功如下图示:
然后按照步骤编译,最后可生成opencv库。编译opencv库过程: