fkie/catkin_lint

False positive with Qt5 components

Closed this issue · 1 comments

Extract of my CMakeLists.txt:

...

## Find Qt5 modules
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
find_package(
  Qt5
  COMPONENTS
  Widgets
  REQUIRED
)

...

catkin_package(
  INCLUDE_DIRS
  include
  CATKIN_DEPENDS
  roscpp
  DEPENDS
  Qt5Widgets
)

...
catkin_lint -W2 .
rqt_app_example: CMakeLists.txt(34): error: catkin_package() lists unconfigured system package 'Qt5Widgets'

This is a false positive, when using the components CMake syntax the variables are correctly populated: Qt5Widgets_INCLUDE_DIRS and Qt5Widgets_LIBRARIES.


Using find_package(Qt5Widgets REQUIRED) works fine but is not what is advised in Qt documentation: https://doc.qt.io/qt-5/cmake-manual.html

catkin_lint does not actually execute any find_package() calls, it blindly assumes that find_package(Module) will populate either Module_ or MODULE_ variables and fails to notice any side effects. Something similar happens with Google Cartographer BTW.

I'll probably end up writing a special case for Qt5, since it's fairly commonly used.