Skip to content

Commit 2ea8697

Browse files
committed
1 parent a286f6e commit 2ea8697

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

base_placement_plugin/CMakeLists.txt

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,18 @@ find_package(catkin REQUIRED COMPONENTS
2020
moveit_core
2121
)
2222

23-
find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)
23+
if(rviz_QT_VERSION VERSION_LESS "5")
24+
find_package(Qt4 ${rviz_QT_VERSION} REQUIRED QtCore QtGui)
25+
include(${QT_USE_FILE})
26+
set(QT_LIBRARIES )
27+
else()
28+
find_package(Qt5 ${rviz_QT_VERSION} REQUIRED Core Widgets Concurrent)
29+
set(QT_LIBRARIES Qt5::Core Qt5::Widgets Qt5::Concurrent)
30+
endif()
31+
# Instruct CMake to run moc automatically when needed.
32+
set(CMAKE_AUTOMOC ON)
33+
2434
find_package(HDF5 REQUIRED)
25-
include(${QT_USE_FILE})
2635

2736

2837
add_definitions(-DQT_NO_KEYWORDS)
@@ -39,7 +48,7 @@ set(base_placement_plugin_SRCS
3948
src/place_base.cpp
4049
src/add_robot_base.cpp
4150

42-
51+
4352
${MOC_FILES}
4453
)
4554

@@ -51,7 +60,7 @@ set(base_placement_plugin_HDRS
5160
include/base_placement_plugin/place_base.h
5261
include/base_placement_plugin/add_robot_base.h
5362

54-
63+
5564
)
5665

5766
set(base_placement_plugin_UIS
@@ -77,12 +86,18 @@ catkin_package(
7786
map_creator
7887
)
7988

80-
qt4_wrap_cpp(base_placement_plugin_MOCS ${base_placement_plugin_HDRS} )
81-
qt4_wrap_ui(base_placement_plugin_UIS_H ${base_placement_plugin_UIS} )
89+
if(rviz_QT_VERSION VERSION_LESS "5")
90+
qt4_wrap_cpp(base_placement_plugin_MOCS ${base_placement_plugin_HDRS} )
91+
qt4_wrap_ui(base_placement_plugin_UIS_H ${base_placement_plugin_UIS} )
92+
else()
93+
qt5_wrap_cpp(base_placement_plugin_MOCS ${base_placement_plugin_HDRS} )
94+
qt5_wrap_ui(base_placement_plugin_UIS_H ${base_placement_plugin_UIS} )
95+
endif()
96+
8297

8398
include_directories(${base_placement_plugin_INCLUDE_DIRECTORIES} ${catkin_INCLUDE_DIRS} ${HDF5_INCLUDE_DIRS})
8499
add_library(${PROJECT_NAME} ${base_placement_plugin_SRCS} ${base_placement_plugin_MOCS} ${base_placement_plugin_UIS_H}) # ${base_placement_plugin_UIS_H}
85-
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} yaml-cpp ${HDF5_LIBRARIES} create_marker)
100+
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_LIBRARIES} yaml-cpp ${HDF5_LIBRARIES} create_marker)
86101
## target_link_libraries(${PROJECT_NAME} yaml-cpp)
87102

88103

0 commit comments

Comments
 (0)