ament / ament/ament_cmake

[ament_export_targets] Use IMPORTED_TARGETS directory property when CMake version is 3.21+

Abierto
#367 3 comentarios 0 reacciones 0 asignados Ver en GitHub
backlog enhancement
Lenguaje dominante
CMake
Estrellas
125
Forks
147
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Currently `ament_export_targets()` 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

https://github.com/ament/ament_cmake/blob/efcbe328d001c9ade93a06bd8035642e37dd6f2a/ament_cmake_export_targets/cmake/ament_cmake_export_targets-extras.cmake.in#L12

Example in an export file the above code matches

```CMake
foreach(_expectedTarget rcutils::rcutils)
```

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`.

https://github.com/ament/ament_cmake/blob/efcbe328d001c9ade93a06bd8035642e37dd6f2a/ament_cmake_export_targets/cmake/ament_cmake_export_targets-extras.cmake.in#L12

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.