Skip to content

Commit

Permalink
Merge pull request #1 from lucasw/qt4and5
Browse files Browse the repository at this point in the history
Support both qt5 (Kinetic) and qt4 (Jade)
  • Loading branch information
ajshort authored Mar 6, 2017
2 parents d78dd1e + 2463df7 commit 304eb91
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,23 @@ include_directories(include
${catkin_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR})

qt5_wrap_cpp(MOC_FILES include/${PROJECT_NAME}/ortho_view_controller.h)
# Use the version that rviz used so they are compatible.
if(rviz_QT_VERSION VERSION_LESS "5")
message(STATUS "Using Qt4 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
find_package(Qt4 ${rviz_QT_VERSION} EXACT REQUIRED QtCore QtGui)
# pull in all required include dirs, define QT_LIBRARIES, etc.
include(${QT_USE_FILE})
qt4_wrap_cpp(MOC_FILES include/${PROJECT_NAME}/ortho_view_controller.h)
else()
message(STATUS "Using Qt5 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}")
find_package(Qt5 ${rviz_QT_VERSION} EXACT REQUIRED Core Widgets)
# make target_link_libraries(${QT_LIBRARIES}) pull in all required dependencies
set(QT_LIBRARIES Qt5::Widgets)
qt5_wrap_cpp(MOC_FILES include/${PROJECT_NAME}/ortho_view_controller.h)
endif()

add_library(${PROJECT_NAME} src/ortho_view_controller.cpp ${MOC_FILES})
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} Qt5::Core Qt5::Gui)
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${QT_LIBRARIES})
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-std=c++11")

# Install
Expand Down

0 comments on commit 304eb91

Please sign in to comment.