diff --git a/rviz_imu_plugin/CMakeLists.txt b/rviz_imu_plugin/CMakeLists.txt
index 6498090..d4a2853 100644
--- a/rviz_imu_plugin/CMakeLists.txt
+++ b/rviz_imu_plugin/CMakeLists.txt
@@ -12,8 +12,10 @@ endif()
find_package(ament_cmake REQUIRED COMPONENTS rviz)
find_package(message_filters REQUIRED)
-find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Test)
-find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Test)
+find_package(Qt6 QUIET COMPONENTS Test Widgets)
+if(NOT Qt6_FOUND)
+ find_package(Qt5 REQUIRED COMPONENTS Test Widgets)
+endif()
find_package(rviz_common REQUIRED)
find_package(rviz_ogre_vendor REQUIRED)
find_package(rviz_rendering REQUIRED)
diff --git a/rviz_imu_plugin/package.xml b/rviz_imu_plugin/package.xml
index 5ec621e..212ab65 100644
--- a/rviz_imu_plugin/package.xml
+++ b/rviz_imu_plugin/package.xml
@@ -13,7 +13,7 @@
ament_cmake
- qt6-base-dev
+ qt-base-dev
message_filters
pluginlib
@@ -25,10 +25,10 @@
tf2
tf2_ros
- libqt6-core
- libqt6gui6t64
- libqt6opengl6t64
- libqt6widgets6t64
+ libqtcore
+ libqtgui
+ libqtopengl
+ libqtwidgets