Handle IMA as an imported target

Most of our dependencies are imported targets already, so while for just
one site this isn't actually any shorter in terms of LoC it's more
consistent with the surroundings in the consuming site, and more so if
we ever need to link to this from some other place.
This commit is contained in:
Panu Matilainen 2023-04-06 10:48:27 +03:00
parent c61da285a1
commit 7184fb8013
2 changed files with 7 additions and 2 deletions

View File

@ -196,6 +196,12 @@ if (WITH_IMAEVM)
list(APPEND REQFUNCS lsetxattr)
find_path(IMA_INCLUDE_DIR NAMES imaevm.h REQUIRED)
find_library(IMA_LIBRARY NAMES imaevm REQUIRED)
add_library(IMA::IMA UNKNOWN IMPORTED)
set_target_properties(IMA::IMA PROPERTIES
IMPORTED_LOCATION "${IMA_LIBRARY}"
INTERFACE "${IMA_HEADER}"
)
endif()
find_program(__FIND_DEBUGINFO find-debuginfo)

View File

@ -8,8 +8,7 @@ target_sources(librpmsign PRIVATE rpmgensig.c)
target_link_libraries(librpmsign PUBLIC librpmio librpm)
if (WITH_IMAEVM)
target_sources(librpmsign PRIVATE rpmsignfiles.c)
target_link_libraries(librpmsign PRIVATE ${IMA_LIBRARY})
target_include_directories(librpmsign PRIVATE ${IMA_INCLUDE_DIR})
target_link_libraries(librpmsign PRIVATE IMA::IMA)
endif()
if (WITH_FSVERITY)
target_sources(librpmsign PRIVATE rpmsignverity.c)