FindPkgConfig: Runtime dependencies with `IMPORTED_TARGET` option
It seems that it only provides the following 4 target properties so far (version "3.24"): (link)
INTERFACE_INCLUDE_DIRECTORIES
INTERFACE_LINK_LIBRARIES
INTERFACE_LINK_OPTIONS
INTERFACE_COMPILE_OPTIONS
I hope pkg_check_modules(... IMPORTED_TARGET ...)
can provide IMPORTED_LOCATION
property, as well. So that we can use GENEX TARGET_RUNTIME_DLLS
to copy RUNTIME dependencies to the output bin
directory on DLL platform (Windows).
For example,
Click to expand
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED IMPORTED_TARGET gtk+-3.0)
set(tgt_name ${PROJECT_NAME})
add_executable(${tgt_name} "main.cpp")
target_link_libraries(${tgt_name}
PRIVATE
PkgConfig::GTK3
)
add_custom_command(TARGET ${tgt_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_RUNTIME_DLLS:${tgt_name}>
$<TARGET_FILE_DIR:${tgt_name}>
COMMAND_EXPAND_LISTS
)
Edited by Brad King