ament_export_include_directoires() not working properly in ros2_humble
This is a mirror question of https://github.com/ament/ament_cmake/issues/419
Recently I upgraded the ROS2 version from galactic
version to humble
, I encountered a problem when compiling some packages of the previous version. After investigation, I think it is a problem with ament_export_include_directories
and ament_export_libraries
.
I wrote a short program to reproduce this bug, you can find it here. Simply put, I now have a caller that references the common library. In common, I export the library through ament_export_include_directories
and ament_export_libraries
, but I can’t reference his(common) header file in the caller. The error is as follows:
But if I use INCLUDES DESTINATION include
in install, the code can work properly. The working code you can find in the fixed branch. Only the CMakeLists of the common package are modified.
But according to the documentation, the two methods can be considered equivalent. And the code on master can be compiled pass in galactic
version.
So this is confusing, and I found out that both methods are also used in nav2, but it doesn't report an error. I guess it might be because I both export the library and generate msgs in the common library, but I'm not sure, I don't see a description of this guideline in the documentation, so I think it's a bug of ament_cmake
.
The code before and after modification is attached:
before:
after:
Asked by zzsqwq on 2022-12-20 22:17:49 UTC
Comments