Skip to content

Commit c1877f5

Browse files
committed
Update CMakeLists.txt
1 parent 63a9621 commit c1877f5

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

CMakeLists.txt

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ find_package(rviz_rendering REQUIRED)
4141
find_package(rviz_default_plugins REQUIRED)
4242

4343

44-
find_package(QT NAMES Qt6 Qt5 COMPONENTS Test Widgets Core5Compat)
44+
find_package(QT NAMES Qt6 Qt5 COMPONENTS Test Widgets)
4545

46-
if(Qt${QT_VERSION_MAJOR} EGUAL "Qt6")
46+
if(Qt${QT_VERSION_MAJOR} STREQUAL "Qt6")
4747
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test Widgets Core5Compat)
4848
if(${QT_VERSION} VERSION_LESS 5.15.0)
4949
function(qt_wrap_cpp out)
@@ -54,7 +54,7 @@ if(Qt${QT_VERSION_MAJOR} EGUAL "Qt6")
5454
elseif()#Qt5
5555
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Test Widgets)
5656
endif()
57-
57+
5858

5959
## Qt5 boilerplate options from http://doc.qt.io/qt-5/cmake-manual.html
6060
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@@ -98,7 +98,12 @@ ament_target_dependencies(${PROJECT_NAME}_gui PUBLIC
9898
rviz_default_plugins
9999
rviz_ogre_vendor
100100
)
101-
target_link_libraries(${PROJECT_NAME}_gui PUBLIC Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Core5Compat)
101+
if(Qt${QT_VERSION_MAJOR} STREQUAL "Qt6")
102+
target_link_libraries(${PROJECT_NAME}_gui PUBLIC Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Core5Compat)
103+
elseif()
104+
target_link_libraries(${PROJECT_NAME}_gui PUBLIC Qt${QT_VERSION_MAJOR}::Widgets )
105+
endif()
106+
102107

103108
# prevent pluginlib from using boost
104109
target_compile_definitions(${PROJECT_NAME}_gui PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS")
@@ -133,10 +138,16 @@ add_library(${PROJECT_NAME} SHARED
133138
)
134139
target_compile_definitions(${PROJECT_NAME} PRIVATE _USE_MATH_DEFINES)
135140
ament_target_dependencies(${PROJECT_NAME} PUBLIC Eigen3)
136-
target_link_libraries(${PROJECT_NAME}
137-
${PROJECT_NAME}_remote_control
138-
Qt${QT_VERSION_MAJOR}::Core5Compat
139-
)
141+
142+
if(Qt${QT_VERSION_MAJOR} STREQUAL "Qt6")
143+
target_link_libraries(${PROJECT_NAME}
144+
${PROJECT_NAME}_remote_control
145+
Qt${QT_VERSION_MAJOR}::Core5Compat
146+
)
147+
elseif()
148+
target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}_remote_control)
149+
endif()
150+
140151
ament_target_dependencies(${PROJECT_NAME}
141152
rclcpp
142153
rclcpp_components

0 commit comments

Comments
 (0)