Skip to content

Commit 327346d

Browse files
committed
Qt6 fix
1 parent b49117c commit 327346d

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

CMakeLists.txt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.20)
22
project(rviz_visual_tools)
33

4-
# Default to C++14
4+
# Default to C++17
55
if(NOT CMAKE_CXX_STANDARD)
6-
set(CMAKE_CXX_STANDARD 14)
6+
set(CMAKE_CXX_STANDARD 17)
77
endif()
88

99
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
@@ -40,7 +40,15 @@ find_package(rviz_common REQUIRED)
4040
find_package(rviz_rendering REQUIRED)
4141
find_package(rviz_default_plugins REQUIRED)
4242

43-
find_package(Qt5 REQUIRED COMPONENTS Widgets)
43+
44+
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Test Widgets Core5Compat)
45+
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test Widgets Core5Compat)
46+
if(${QT_VERSION} VERSION_LESS 5.15.0)
47+
function(qt_wrap_cpp out)
48+
qt5_wrap_cpp(_sources ${ARGN})
49+
set("${out}" ${_sources} PARENT_SCOPE)
50+
endfunction()
51+
endif()
4452

4553
## Qt5 boilerplate options from http://doc.qt.io/qt-5/cmake-manual.html
4654
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -84,7 +92,7 @@ ament_target_dependencies(${PROJECT_NAME}_gui PUBLIC
8492
rviz_default_plugins
8593
rviz_ogre_vendor
8694
)
87-
target_link_libraries(${PROJECT_NAME}_gui PUBLIC Qt5::Widgets)
95+
target_link_libraries(${PROJECT_NAME}_gui PUBLIC Qt${QT_VERSION_MAJOR}::Widgets)
8896

8997
# prevent pluginlib from using boost
9098
target_compile_definitions(${PROJECT_NAME}_gui PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS")

0 commit comments

Comments
 (0)