mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 12:16:40 +08:00
export: Allow multiple exports when only one export is installed
Since commit c8997fc046
(export: Allow depending on targets exported
multiple times, 2024-12-26, v4.0.0-rc1~241^2), it is possible to depend
on a target exported multiple times so long as the target is exported in
only one set and with a consistent namespace. However, as a
side-effect, a target could not be in multiple export sets even if only
one of those sets was installed.
Update the check so that uninstalled export sets do not count towards a
target being exported multiple times.
This commit is contained in:
@@ -280,12 +280,14 @@ cmExportFileGenerator::ExportInfo cmExportInstallFileGenerator::FindExportInfo(
|
|||||||
[&name](std::unique_ptr<cmTargetExport> const& te) {
|
[&name](std::unique_ptr<cmTargetExport> const& te) {
|
||||||
return te->TargetName == name;
|
return te->TargetName == name;
|
||||||
})) {
|
})) {
|
||||||
exportSets.insert(exp.first);
|
|
||||||
std::vector<cmInstallExportGenerator const*> const* installs =
|
std::vector<cmInstallExportGenerator const*> const* installs =
|
||||||
exportSet.GetInstallations();
|
exportSet.GetInstallations();
|
||||||
for (cmInstallExportGenerator const* install : *installs) {
|
if (!installs->empty()) {
|
||||||
exportFiles.push_back(install->GetDestinationFile());
|
exportSets.insert(exp.first);
|
||||||
namespaces.insert(install->GetNamespace());
|
for (cmInstallExportGenerator const* install : *installs) {
|
||||||
|
exportFiles.push_back(install->GetDestinationFile());
|
||||||
|
namespaces.insert(install->GetNamespace());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,4 @@
|
|||||||
|
project(DependsMultipleNotInstalled CXX)
|
||||||
|
set(NAMESPACE foo::)
|
||||||
|
include(DependsMultipleCommon.cmake)
|
||||||
|
install(TARGETS foo EXPORT foo-alt) # set foo-alt never installed
|
@@ -34,3 +34,4 @@ run_cmake(LowerCaseFile)
|
|||||||
run_cmake(Requirements)
|
run_cmake(Requirements)
|
||||||
run_cmake(TargetTypes)
|
run_cmake(TargetTypes)
|
||||||
run_cmake(DependsMultiple)
|
run_cmake(DependsMultiple)
|
||||||
|
run_cmake(DependsMultipleNotInstalled)
|
||||||
|
Reference in New Issue
Block a user