Prerelease melodic Qt5 cmake error
Hey, I am currently trying to do my prerelease tests for a melodic version of my meta-package robot_statemachine which was already released for kinetic.
Unfortunately, when running the prerelease tests for melodic, I encountered various errors related to Qt5 dependencies. The meta-package includes two packages which are basically plugins, one for rqt and the other for rviz. Unfortunately, when running the prerelease script on docker, both fail with the below errors:
rsm_rviz_plugins error:
CMake Error at CMakeLists.txt:31 (find_package):
By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5" (requested
version 5.9.5) with any of the following names:
Qt5Config.cmake
qt5-config.cmake
Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
to a directory containing one of the above files. If "Qt5" provides a
separate development package or SDK, be sure it has been installed.
rsm_rqt_plugins error:
CMake Error at CMakeLists.txt:17 (find_package):
By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"Qt5Widgets", but CMake did not find one.
Could not find a package configuration file provided by "Qt5Widgets" with
any of the following names:
Qt5WidgetsConfig.cmake
qt5widgets-config.cmake
Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
"Qt5Widgets_DIR" to a directory containing one of the above files. If
"Qt5Widgets" provides a separate development package or SDK, be sure it has
been installed.
After some research I found this question. Following the answer I added a build dependency for qtbase5-dev
. Unfortunately, this only lead to the following new error:
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "qtbase5-dev" with
any of the following names:
qtbase5-devConfig.cmake
qtbase5-dev-config.cmake
Add the installation prefix of "qtbase5-dev" to CMAKE_PREFIX_PATH or set
"qtbase5-dev_DIR" to a directory containing one of the above files. If
"qtbase5-dev" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
CMakeLists.txt:6 (find_package)
Therefore, my question: Could someone point me out how to correctly include the Qt5 dependencies for rviz and rqt plugins in ROS melodic? Below you can see my CMakeLists and package files for the two packages throwing errors.
rsm_rqt_plugins: CMakeLists.txt:
cmake_minimum_required(VERSION 2.8.3)
project(rsm_rqt_plugins)
add_compile_options(-std=c++11)
find_package(catkin REQUIRED COMPONENTS
roscpp
rqt_gui
rqt_gui_cpp
rsm_msgs
std_msgs
std_srvs
)
set(CMAKE_AUTORCC ON)
find_package(cmake_modules REQUIRED)
find_package(Qt5Widgets REQUIRED)
include_directories(${Qt5Widgets_INCLUDE_DIRS} include)
###################################
## catkin specific configuration ##
###################################
catkin_package(
INCLUDE_DIRS ${INC_DIR}
LIBRARIES ${PROJECT_NAME}
${CMAKE_CURRENT_BINARY_DIR}/..
${CMAKE_CURRENT_BINARY_DIR}
CATKIN_DEPENDS roscpp rqt_gui rqt_gui_cpp
)
###########
## Build ##
###########
## set variables for Statemachine Control node
set(SRCS_CONTROLS
src/RSMControls.cpp
)
set(HDRS_CONTROLS
src/RSMControls.h
)
set(UIS_CONTROLS
src/rsm_controls.ui
)
set(INC_DIR
include
${CMAKE_CURRENT_BINARY_DIR}
)
##########################################################################################
# qt5_wrap_cpp produces moc files for all headers listed
# qt5_wrap_ui produces .h files for all .ui files listed
## Statemachine Control:
qt5_wrap_cpp(MOCS_SRCS_CONTROLS ${HDRS_CONTROLS})
qt5_wrap_ui(UI_HEADER_CONTROLS ...