Install library with GET_RUNTIME_DEPENDENCIES from POST_EXCLUDE_FILES_STRICT

I’ve looked through the many posts about GET_RUNTIME_DEPENDENCIES and don’t see my question answered, but I apologize if I missed something.

I am trying to install some libraries required for a target. These libraries are not installed normally because they come from a submodule which builds them but excludes them from INSTALL. I only want to install the libraries from this submodule that are required for my target, not all that are built.

Unfortunately, because these .sos are in the dependency set for my target they are added to POST_EXCLUDE_FILES_STRICT for GET_RUNTIME_DEPENDENCIES here Source/cmInstallGetRuntimeDependenciesGenerator.cxx:192.

Is there a better way to install dependencies like this? I can manually install the TARGETS I need, but this seems brittle and GET_RUNTIME_DEPENDENCIES is perfect, except for this exclusion. Thanks!

This is documented. The genex explicitly excludes files generated by the current build system (to avoid double installation). You should add install rules for the submodule’s targets.

The submodule dependencies are transitive through a number of different targets using target_link_librarires, all subject to change, so I am trying to avoid listing them with my install. My current workaround is to create a RUNTIME_DEPENDENCY_SET with IMPORTED_RUNTIME_ARTIFACTS and install the set, which gets around the exclusion, but I imagine there is cleaner way I’m missing.