From 444cfdfc1846a98356fe8b7b084179b9d70927a3 Mon Sep 17 00:00:00 2001 From: wep21 Date: Sat, 29 Jun 2024 02:08:16 +0900 Subject: [PATCH] use qt version for windows workaround Signed-off-by: wep21 --- rviz2/CMakeLists.txt | 9 ++------- rviz_common/CMakeLists.txt | 9 +++------ rviz_common/rviz_common-extras.cmake | 9 ++------- rviz_default_plugins/CMakeLists.txt | 9 +++------ rviz_default_plugins/rviz_default_plugins-extras.cmake | 9 ++------- rviz_rendering/CMakeLists.txt | 9 +++------ rviz_rendering/rviz_rendering-extras.cmake | 9 ++------- rviz_rendering_tests/CMakeLists.txt | 9 +++------ rviz_visual_testing_framework/CMakeLists.txt | 9 ++------- 9 files changed, 22 insertions(+), 59 deletions(-) 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 59a8972cf..be691674d 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 9d652d598..5de5a16c5 100644 --- a/rviz_common/rviz_common-extras.cmake +++ b/rviz_common/rviz_common-extras.cmake @@ -30,10 +30,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 1d2d565b8..df514d1f4 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 ba6af27a6..5e73d681a 100644 --- a/rviz_default_plugins/rviz_default_plugins-extras.cmake +++ b/rviz_default_plugins/rviz_default_plugins-extras.cmake @@ -29,10 +29,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 0c647b43d..e69157996 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 58b2ffe3c..af934a9a3 100644 --- a/rviz_rendering/rviz_rendering-extras.cmake +++ b/rviz_rendering/rviz_rendering-extras.cmake @@ -30,10 +30,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)