@@ -20,7 +20,8 @@ if(WIN32)
2020endif ()
2121
2222find_package (pluginlib REQUIRED)
23- find_package (Qt5 REQUIRED COMPONENTS Widgets)
23+ find_package (QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Core)
24+ find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Core)
2425find_package (tinyxml2_vendor REQUIRED)
2526find_package (TinyXML2 REQUIRED)
2627
@@ -44,7 +45,12 @@ set(qt_gui_cpp_HDRS
4445 include /qt_gui_cpp/plugin_context.h
4546)
4647
47- qt5_wrap_cpp(qt_gui_cpp_MOCS ${qt_gui_cpp_HDRS} )
48+ if (${QT_VERSION_MAJOR} GREATER "5" )
49+ qt_standard_project_setup()
50+ qt_wrap_cpp (turtlesim_node_MOCS ${qt_gui_cpp_HDRS} )
51+ else ()
52+ qt5_wrap_cpp(turtlesim_node_MOCS ${qt_gui_cpp_HDRS} )
53+ endif ()
4854
4955add_library (${PROJECT_NAME} SHARED ${qt_gui_cpp_SRCS} ${qt_gui_cpp_MOCS} )
5056target_include_directories (${PROJECT_NAME} PUBLIC
@@ -54,17 +60,17 @@ target_include_directories(${PROJECT_NAME} PUBLIC
5460target_link_libraries (${PROJECT_NAME}
5561 ${QT_QTCORE_LIBRARY}
5662 ${QT_QTGUI_LIBRARY}
57- Qt5 ::Widgets
63+ Qt ${QT_VERSION_MAJOR} ::Widgets
5864 pluginlib::pluginlib
5965 tinyxml2::tinyxml2)
6066
6167add_subdirectory (src/qt_gui_cpp_shiboken)
6268add_subdirectory (src/qt_gui_cpp_sip)
6369
64- message (STATUS "Python binding generators: ${qt_gui_cpp_BINDINGS} " )
65- if (NOT qt_gui_cpp_BINDINGS)
66- message (FATAL_ERROR "No Python binding generator found." )
67- endif ()
70+ # message(STATUS "Python binding generators: ${qt_gui_cpp_BINDINGS}")
71+ # if(NOT qt_gui_cpp_BINDINGS)
72+ # message(FATAL_ERROR "No Python binding generator found.")
73+ # endif()
6874
6975install (FILES plugin.xml
7076 DESTINATION share/${PROJECT_NAME} )
0 commit comments