diff --git a/rviz2/CMakeLists.txt b/rviz2/CMakeLists.txt index 4bff4496e..815df84df 100644 --- a/rviz2/CMakeLists.txt +++ b/rviz2/CMakeLists.txt @@ -18,13 +18,8 @@ find_package(rviz_common REQUIRED) find_package(rviz_ogre_vendor REQUIRED) -if(MSVC) - set(QT_VERSION_MAJOR 5) - find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) -else() - find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) - find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) -endif() +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) # TODO(wjwwood): this block is to setup the windeployqt tool, could be removed later. if(Qt${QT_VERSION_MAJOR}_FOUND AND WIN32 AND TARGET Qt${QT_VERSION_MAJOR}::qmake AND NOT TARGET Qt${QT_VERSION_MAJOR}::windeployqt) get_target_property(_qt_qmake_location Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION) diff --git a/rviz_common/CMakeLists.txt b/rviz_common/CMakeLists.txt index 6c3ec5e8d..e720e459b 100644 --- a/rviz_common/CMakeLists.txt +++ b/rviz_common/CMakeLists.txt @@ -31,16 +31,13 @@ find_package(ament_cmake REQUIRED) # do find_package(rviz_ogre_vendor) first to make sure the custom OGRE is found find_package(rviz_ogre_vendor REQUIRED) -if(MSVC) - set(QT_VERSION_MAJOR 5) - find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) +if(${QT_VERSION} VERSION_LESS 5.15.0) function(qt_wrap_cpp out) qt5_wrap_cpp(_sources ${ARGN}) set("${out}" ${_sources} PARENT_SCOPE) endfunction() -else() - find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) - find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) endif() find_package(geometry_msgs REQUIRED) diff --git a/rviz_common/rviz_common-extras.cmake b/rviz_common/rviz_common-extras.cmake index 3f4ef59fa..f3c88a8d3 100644 --- a/rviz_common/rviz_common-extras.cmake +++ b/rviz_common/rviz_common-extras.cmake @@ -27,10 +27,5 @@ # find package Qt5 because otherwise using the rviz_common::rviz_common # exported target will complain that the Qt5::Widgets target does not exist -if(MSVC) - set(QT_VERSION_MAJOR 5) - find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets) -else() - find_package(QT NAMES Qt6 Qt5 QUIET COMPONENTS Widgets) - find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets) -endif() +find_package(QT NAMES Qt6 Qt5 QUIET COMPONENTS Widgets) +find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets) diff --git a/rviz_default_plugins/CMakeLists.txt b/rviz_default_plugins/CMakeLists.txt index 2ed54257c..1672cdac2 100644 --- a/rviz_default_plugins/CMakeLists.txt +++ b/rviz_default_plugins/CMakeLists.txt @@ -57,16 +57,13 @@ find_package(rviz_common REQUIRED) find_package(rviz_rendering REQUIRED) find_package(rviz_ogre_vendor REQUIRED) -if(MSVC) - set(QT_VERSION_MAJOR 5) - find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test Widgets) +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Test Widgets) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test Widgets) +if(${QT_VERSION} VERSION_LESS 5.15.0) function(qt_wrap_cpp out) qt5_wrap_cpp(_sources ${ARGN}) set("${out}" ${_sources} PARENT_SCOPE) endfunction() -else() - find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Test Widgets) - find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test Widgets) endif() find_package(geometry_msgs REQUIRED) diff --git a/rviz_default_plugins/rviz_default_plugins-extras.cmake b/rviz_default_plugins/rviz_default_plugins-extras.cmake index 0bf7ded76..a24df7629 100644 --- a/rviz_default_plugins/rviz_default_plugins-extras.cmake +++ b/rviz_default_plugins/rviz_default_plugins-extras.cmake @@ -27,10 +27,5 @@ # find package Qt5 because otherwise using the rviz_default_plugins::rviz_default_plugins # exported target will complain that the Qt5::Widgets target does not exist -if(MSVC) - set(QT_VERSION_MAJOR 5) - find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets) -else() - find_package(QT NAMES Qt6 Qt5 QUIET COMPONENTS Widgets) - find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets) -endif() +find_package(QT NAMES Qt6 Qt5 QUIET COMPONENTS Widgets) +find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets) diff --git a/rviz_rendering/CMakeLists.txt b/rviz_rendering/CMakeLists.txt index 2ebdb5ef4..77880dc2b 100644 --- a/rviz_rendering/CMakeLists.txt +++ b/rviz_rendering/CMakeLists.txt @@ -33,16 +33,13 @@ find_package(ament_cmake_ros REQUIRED) find_package(rviz_ogre_vendor REQUIRED) find_package(rviz_assimp_vendor REQUIRED) -if(MSVC) - set(QT_VERSION_MAJOR 5) - find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) +if(${QT_VERSION} VERSION_LESS 5.15.0) function(qt_wrap_cpp out) qt5_wrap_cpp(_sources ${ARGN}) set("${out}" ${_sources} PARENT_SCOPE) endfunction() -else() - find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) - find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) endif() find_package(ament_index_cpp REQUIRED) diff --git a/rviz_rendering/rviz_rendering-extras.cmake b/rviz_rendering/rviz_rendering-extras.cmake index f30c469d9..05e19f9a2 100644 --- a/rviz_rendering/rviz_rendering-extras.cmake +++ b/rviz_rendering/rviz_rendering-extras.cmake @@ -27,10 +27,5 @@ # find package Qt5 because otherwise using the rviz_rendering::rviz_rendering # exported target will complain that the Qt5::Widgets target does not exist -if(MSVC) - set(QT_VERSION_MAJOR 5) - find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets) -else() - find_package(QT NAMES Qt6 Qt5 QUIET COMPONENTS Widgets) - find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets) -endif() +find_package(QT NAMES Qt6 Qt5 QUIET COMPONENTS Widgets) +find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets) diff --git a/rviz_rendering_tests/CMakeLists.txt b/rviz_rendering_tests/CMakeLists.txt index bf4f114cd..a19977642 100644 --- a/rviz_rendering_tests/CMakeLists.txt +++ b/rviz_rendering_tests/CMakeLists.txt @@ -32,16 +32,13 @@ find_package(ament_cmake REQUIRED) if(BUILD_TESTING) # do find_package(rviz_ogre_vendor) first to make sure the custom OGRE is found find_package(rviz_ogre_vendor REQUIRED) - if(MSVC) - set(QT_VERSION_MAJOR 5) - find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) + find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) + find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) + if(${QT_VERSION} VERSION_LESS 5.15.0) function(qt_wrap_cpp out) qt5_wrap_cpp(_sources ${ARGN}) set("${out}" ${_sources} PARENT_SCOPE) endfunction() - else() - find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) - find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) endif() find_package(rviz_rendering REQUIRED) find_package(resource_retriever REQUIRED) diff --git a/rviz_visual_testing_framework/CMakeLists.txt b/rviz_visual_testing_framework/CMakeLists.txt index e30361981..2ffa5c9b4 100644 --- a/rviz_visual_testing_framework/CMakeLists.txt +++ b/rviz_visual_testing_framework/CMakeLists.txt @@ -25,13 +25,8 @@ endif() find_package(ament_cmake REQUIRED) find_package(geometry_msgs REQUIRED) -if(MSVC) - set(QT_VERSION_MAJOR 5) - find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test Widgets) -else() - find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Test Widgets) - find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test Widgets) -endif() +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Test Widgets) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test Widgets) find_package(rclcpp REQUIRED) find_package(rcutils REQUIRED) find_package(rviz_common REQUIRED)