Posting this because I want to share the solution.
Got this error when trying to cmake OpenCV :
-- Found PNG: /usr/lib/arm-linux-gnueabihf/libpng.so (found version "1.2.50")
-- Looking for /usr/include/libpng/png.h
-- Looking for /usr/include/libpng/png.h - found
-- Found OpenEXR: /usr/lib/arm-linux-gnueabihf/libIlmImf.so
CMake Error at /usr/lib/arm-linux-gnueabihf/cmake/Qt5OpenGL/Qt5OpenGLConfig.cmake:27 (message):
The imported target "Qt5::OpenGL" references the file
"/usr/lib/arm-linux-gnueabihf/libQt5OpenGL.so.5.3.2"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/arm-linux-gnueabihf/cmake/Qt5OpenGL/Qt5OpenGLConfig.cmake"
but not all the files it references.
Call Stack (most recent call first):
/usr/lib/arm-linux-gnueabihf/cmake/Qt5OpenGL/Qt5OpenGLConfig.cmake:44 (_qt5_OpenGL_check_file_exists)
/usr/lib/arm-linux-gnueabihf/cmake/Qt5OpenGL/Qt5OpenGLConfig.cmake:134 (_populate_OpenGL_target_properties)
cmake/OpenCVFindLibsGUI.cmake:26 (find_package)
CMakeLists.txt:601 (include)
When trying to reinstall qt (apt-get install qt5-default) got a message saying it was already installed, so I solved it by adding a symlink:
ln -s /usr/lib/arm-linux-gnueabihf/libQt5OpenGL.so.5.3.2 /usr/lib/arm-linux-gnueabihf/libQtOpenGL.so
If you can't find your QtOpenGL library just run a find / -name "libQt*" query and see if anything similar comes up.