1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
3 #include "cmInstallRuntimeDependencySet.h"
9 #include "cmGeneratorTarget.h"
10 #include "cmGlobalGenerator.h"
11 #include "cmInstallImportedRuntimeArtifactsGenerator.h"
12 #include "cmInstallTargetGenerator.h"
13 #include "cmStateTypes.h"
14 #include "cmTargetDepend.h"
16 cmInstallRuntimeDependencySet::cmInstallRuntimeDependencySet(std::string name
)
17 : Name(std::move(name
))
21 void cmInstallRuntimeDependencySet::AddExecutable(
22 std::unique_ptr
<Item
> executable
)
24 this->Executables
.push_back(std::move(executable
));
27 void cmInstallRuntimeDependencySet::AddLibrary(std::unique_ptr
<Item
> library
)
29 this->Libraries
.push_back(std::move(library
));
32 void cmInstallRuntimeDependencySet::AddModule(std::unique_ptr
<Item
> module
)
34 this->Modules
.push_back(std::move(module
));
37 bool cmInstallRuntimeDependencySet::AddBundleExecutable(
38 std::unique_ptr
<Item
> bundleExecutable
)
40 if (this->BundleExecutable
) {
43 this->BundleExecutable
= bundleExecutable
.get();
44 this->AddExecutable(std::move(bundleExecutable
));
48 std::string
cmInstallRuntimeDependencySet::TargetItem::GetItemPath(
49 const std::string
& config
) const
51 return this->Target
->GetTarget()->GetFullPath(config
);
55 const std::set
<const cmGeneratorTarget
*>& GetTargetDependsClosure(
56 std::map
<const cmGeneratorTarget
*, std::set
<const cmGeneratorTarget
*>>&
58 const cmGeneratorTarget
* tgt
)
60 auto it
= targetDepends
.insert({ tgt
, {} });
61 auto& retval
= it
.first
->second
;
63 auto const& deps
= tgt
->GetGlobalGenerator()->GetTargetDirectDepends(tgt
);
64 for (auto const& dep
: deps
) {
65 if (!dep
.IsCross() && dep
.IsLink()) {
66 auto type
= dep
->GetType();
67 if (type
== cmStateEnums::EXECUTABLE
||
68 type
== cmStateEnums::SHARED_LIBRARY
||
69 type
== cmStateEnums::MODULE_LIBRARY
) {
72 auto const& depDeps
= GetTargetDependsClosure(targetDepends
, dep
);
73 retval
.insert(depDeps
.begin(), depDeps
.end());
81 void cmInstallRuntimeDependencySet::TargetItem::AddPostExcludeFiles(
82 const std::string
& config
, std::set
<std::string
>& files
,
83 cmInstallRuntimeDependencySet
* set
) const
85 for (auto const* dep
: GetTargetDependsClosure(set
->TargetDepends
,
86 this->Target
->GetTarget())) {
87 files
.insert(dep
->GetFullPath(config
));
91 std::string
cmInstallRuntimeDependencySet::ImportedTargetItem::GetItemPath(
92 const std::string
& config
) const
94 return this->Target
->GetTarget()->GetFullPath(config
);