I am setting CMAKE to include QGLViewer for a Qt5 project. However as soon as I try to compile the project CMAKE stops with the following error:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: QGLVIEWER_LIBRARY linked by target "sfm" in directory /home/emanuele/sfm
QGLViewer is present on the following path: usr/include/QGLViewer
as it is possible to see from this print screen:
And here is how I set the path on CMAKE:
Additionally I found this source that was helpful for understanding how to declare the lib. Also this post was useful to point me in the correct route, but still not working.
Below the most important CMAKE part that is causing the issue:
cmake_minimum_required(VERSION 3.11)
project(sfm)
########### options ###############
SET(USE_QT TRUE CACHE BOOL)
########### END options ###########
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -g")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
########### OpenMP ################
find_package(OpenMP)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
########### END OpenMP ############
########### OpenCV ################
set (OpenCV_DIR /home/emanuele/opencv/build)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
list(APPEND LINK_LIBRARIES ${OpenCV_LIBS})
########### END OpenCV ############
########### Qt 5 ##################
IF (USE_QT)
ADD_DEFINITIONS("-DUSE_QT")
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Xml REQUIRED)
find_package(Qt5OpenGL REQUIRED)
include_directories(${Qt5Widgets_INCLUDE_DIRS}
${Qt5Xml_INCLUDE_DIRS}
${Qt5OpenGL_INCLUDE_DIRS}
)
list(APPEND LINK_LIBRARIES Qt5::Widgets Qt5::Xml Qt5::OpenGL)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
include_directories(src/ui/mainwindow src/ui/widgets)
find_package(OpenGL REQUIRED)
find_library(QGLVIEWER_LIBRARY
NAMES qglviewer-qt5 qglviewer QGLViewer QGLViewer2)
list(APPEND LINK_LIBRARIES ${QGLVIEWER_LIBRARY} ${OPENGL_LIBRARIES})
ENDIF (USE_QT)
########### END Qt 5 ##############
########### sources ###############
file(GLOB_RECURSE SOURCE_FILES "src/*.cpp")
add_executable(sfm ${SOURCE_FILES})
########### END sources ###########
########### headers ###############
include_directories(src)
########### END headers ###########
########### link libraries ########
target_link_libraries(sfm ${LINK_LIBRARIES})
########### END link libraries ####
I expect CMAKE to compile but the actual result I have is shown in the print screen below keeping me from moving ahead: