mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +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) {
|
||||
return te->TargetName == name;
|
||||
})) {
|
||||
exportSets.insert(exp.first);
|
||||
std::vector<cmInstallExportGenerator const*> const* installs =
|
||||
exportSet.GetInstallations();
|
||||
for (cmInstallExportGenerator const* install : *installs) {
|
||||
exportFiles.push_back(install->GetDestinationFile());
|
||||
namespaces.insert(install->GetNamespace());
|
||||
if (!installs->empty()) {
|
||||
exportSets.insert(exp.first);
|
||||
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(TargetTypes)
|
||||
run_cmake(DependsMultiple)
|
||||
run_cmake(DependsMultipleNotInstalled)
|
||||
|
Reference in New Issue
Block a user