You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently ament_export_targets(<export_name>) is given the name of the export which export targets, but it doesn't actually know what targets that export name is going to be used to export. When a package using ament_export_targets() is find_package()'d by a downstream package, it will search for matches to a regex on the generated export file to get a list of targets it exports. These targets are then added to a package_TARGETS variable. This is a little fragile as any upstream changes to CMake could break the regex matching
CMake 3.21 adds a directory property IMPORTED_TARGETS that would allow the info to be queried directly. If one queries IMPORTED_TARGETS before and after including the export file, then all the new imported targets can be added to package_TARGETS.
This caused multiple of my colleagues to waste several hours with mysterious build errors today, and I just spent several hours getting to the point where I (finally) found this issue.
If this was a known-going-to-break, at least fail on cmake >= 3.24, rather then wasting so much time.
Currently
ament_export_targets(<export_name>)
is given the name of the export which export targets, but it doesn't actually know what targets that export name is going to be used to export. When a package usingament_export_targets()
isfind_package()
'd by a downstream package, it will search for matches to a regex on the generated export file to get a list of targets it exports. These targets are then added to apackage_TARGETS
variable. This is a little fragile as any upstream changes to CMake could break the regex matchingament_cmake/ament_cmake_export_targets/cmake/ament_cmake_export_targets-extras.cmake.in
Line 12 in efcbe32
Example in an export file the above code matches
foreach(_expectedTarget rcutils::rcutils)
CMake 3.21 adds a directory property
IMPORTED_TARGETS
that would allow the info to be queried directly. If one queriesIMPORTED_TARGETS
before and after including the export file, then all the new imported targets can be added topackage_TARGETS
.ament_cmake/ament_cmake_export_targets/cmake/ament_cmake_export_targets-extras.cmake.in
Line 12 in efcbe32
The text was updated successfully, but these errors were encountered: