feat: support public/interface dependencies in packer

This commit is contained in:
2026-08-06 12:48:41 +08:00
parent 7527d3763f
commit ccf19ac0ab
7 changed files with 148 additions and 7 deletions
@@ -10,5 +10,8 @@ includedir=${prefix}/include
Name: {{ name }}
Description: {{ description }}
Version: {{ version }}
{% if len(requires) != 0 -%}
Requires: {{ requires | join(", ") }}
{%- endif %}
Libs: -L${libdir} -l{{ artifact }}
Cflags: -I${includedir}
@@ -32,5 +32,16 @@ else()
)
endif()
{% if len(dependencies) != 0 -%}
{# Pull in declared dependencies and wire them into the imported target -#}
include(CMakeFindDependencyMacro)
{% for dep in dependencies -%}
find_dependency({{ dep.package }})
{% endfor -%}
set_target_properties({{ namespace }}::{{ target }} PROPERTIES
INTERFACE_LINK_LIBRARIES "{{ dependencies | map(attribute='target') | join(';') }}"
)
{%- endif %}
{# Cleanup temporary variables -#}
set(_IMPORT_PREFIX)