Proposal: get_targets
I'm trying to explore ways to write a Conan recipe from CMake. It requires knowing which targets the project installs and where they are installed. The first step requires me to get a list of targets, and if I'm following common convention (as I see it, please correct me if I'm wrong), then I've added all my installed targets to an export set (so that I can write the export file and include that file from the package configuration file). Thus, "getting a list of installed targets" is equivalent to "getting the targets in the installed export set" (which has a conventional name, ${PROJECT_NAME}-targets
).
As a first approximation, I've written a module that gets a list of all targets when called as future_get_targets(${CMAKE_SOURCE_DIR})
. If a project installs every target that it defines, then this is good enough.
What I would really like is a command for getting the list of targets added to an export set, which I've implemented in !3415 (closed).