Ask Your Question
1

How to go back to QT4 after failing to work with QT5?

asked 2013-06-13 20:20:29 -0500

mtngardener gravatar image

I ran into issues with QT5, so I am trying to go back to QT4.

Somehow CMake still wants QT5 and I don't know how it knows QT5 was ever installed. How can I tell CMake to forget QT5?

Here is my failed CMake output (just the beginning):

CMake Warning at cmake/OpenCVFindLibsGUI.cmake:19 (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" with any of the following names:

Qt5CoreConfig.cmake
qt5core-config.cmake
edit retag flag offensive close merge delete

Comments

I still can't answer my own questions, though I am a member now for much longer than two days =)

The answer is that you have to edit cmake/OpenCVFindLibsGUI.cmake to do this, or else delete all of the QT5 files. I didn't want to delete QT5 so I commented out the conditional at the beginning of that file which searches for QT5 packages, and if it finds them then it will cause you to use QT5:

if(WITH_QT)

if(NOT CMAKE_VERSION VERSION_LESS 2.8.3 AND NOT WITH_QT EQUAL 4)

# find_package(Qt5Core) # find_package(Qt5Gui) # find_package(Qt5Widgets) #find_package(Qt5Test)

find_package(Qt5Concurrent)

if(Qt5Core_FOUND AND Qt5Gui_FOUND AND Qt5Widgets_FOUND AND #Qt5Test_FOUND AND Qt5Concurrent_FOUND)

set(HAVE_QT5 ON)

set(HAVE_QT ON)

add_definitions(-DHAV

mtngardener gravatar imagemtngardener ( 2013-06-14 02:09:45 -0500 )edit

Worked for me!

Shivanand Pattanshetti gravatar imageShivanand Pattanshetti ( 2018-09-13 10:09:52 -0500 )edit

2 answers

Sort by » oldest newest most voted
1

answered 2013-06-14 02:20:59 -0500

Vladislav Vinogradov gravatar image

Set the CMake variable WITH_QT to 4:

cmake -DWITH_QT=4 <path to opencv>

By the way, it is not an error. It is just a warning that CMake couldn't find Qt5, but it found Qt4.

edit flag offensive delete link more

Comments

Thanks! I didn't know how to set CMake variables. Is there a good way to do this from the CMake gui in Windows? I am never actually executing the CMake commands directly, just clicking the "configure" and "generate" buttons.

mtngardener gravatar imagemtngardener ( 2013-06-15 00:08:46 -0500 )edit
0

answered 2013-07-11 07:36:31 -0500

ALL CMake file you need are under the path

...../Qt5.1.0/5.1.0/gcc/lib/cmake

not in the .../Qt5.1.0/5.1.0/gcc/lib/

I specified them under cmake-gui one by one ( Qt5Core_DIR , Qt5Test_DIR .....)

If there is any EGL or OpenGL error shows up

You have to install OpenGL

sudo apt-get install build-essential

sudo apt-get install libgl1-mesa-dev

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-06-13 20:20:29 -0500

Seen: 3,311 times

Last updated: Jul 11 '13