diff --git a/base_placement_plugin/CMakeLists.txt b/base_placement_plugin/CMakeLists.txt index d4aba6e..7f7a3f3 100644 --- a/base_placement_plugin/CMakeLists.txt +++ b/base_placement_plugin/CMakeLists.txt @@ -20,9 +20,18 @@ find_package(catkin REQUIRED COMPONENTS moveit_core ) -find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED) +if(rviz_QT_VERSION VERSION_LESS "5") + find_package(Qt4 ${rviz_QT_VERSION} REQUIRED QtCore QtGui) + include(${QT_USE_FILE}) + set(QT_LIBRARIES ) +else() + find_package(Qt5 ${rviz_QT_VERSION} REQUIRED Core Widgets Concurrent) + set(QT_LIBRARIES Qt5::Core Qt5::Widgets Qt5::Concurrent) +endif() +# Instruct CMake to run moc automatically when needed. +set(CMAKE_AUTOMOC ON) + find_package(HDF5 REQUIRED) -include(${QT_USE_FILE}) add_definitions(-DQT_NO_KEYWORDS) @@ -39,7 +48,7 @@ set(base_placement_plugin_SRCS src/place_base.cpp src/add_robot_base.cpp - + ${MOC_FILES} ) @@ -51,7 +60,7 @@ set(base_placement_plugin_HDRS include/base_placement_plugin/place_base.h include/base_placement_plugin/add_robot_base.h - + ) set(base_placement_plugin_UIS @@ -77,12 +86,18 @@ catkin_package( map_creator ) -qt4_wrap_cpp(base_placement_plugin_MOCS ${base_placement_plugin_HDRS} ) -qt4_wrap_ui(base_placement_plugin_UIS_H ${base_placement_plugin_UIS} ) +if(rviz_QT_VERSION VERSION_LESS "5") + qt4_wrap_cpp(base_placement_plugin_MOCS ${base_placement_plugin_HDRS} ) + qt4_wrap_ui(base_placement_plugin_UIS_H ${base_placement_plugin_UIS} ) +else() + qt5_wrap_cpp(base_placement_plugin_MOCS ${base_placement_plugin_HDRS} ) + qt5_wrap_ui(base_placement_plugin_UIS_H ${base_placement_plugin_UIS} ) +endif() + include_directories(${base_placement_plugin_INCLUDE_DIRECTORIES} ${catkin_INCLUDE_DIRS} ${HDF5_INCLUDE_DIRS}) add_library(${PROJECT_NAME} ${base_placement_plugin_SRCS} ${base_placement_plugin_MOCS} ${base_placement_plugin_UIS_H}) # ${base_placement_plugin_UIS_H} -target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} yaml-cpp ${HDF5_LIBRARIES} create_marker) +target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_LIBRARIES} yaml-cpp ${HDF5_LIBRARIES} create_marker) ## target_link_libraries(${PROJECT_NAME} yaml-cpp)