summaryrefslogtreecommitdiffstats
path: root/Source/cmInstallCommand.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2022-02-17 19:43:06 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2022-02-17 19:43:06 (GMT)
commit058b8a0bfb722b3a75ca051c0e1f7b1261643815 (patch)
tree6b2b4973b47d24da25f222dd49e6c60c2033e104 /Source/cmInstallCommand.cxx
parent9c81f2cb8bcb5f4ad96f2ad527035649bd70d5fc (diff)
downloadCMake-058b8a0bfb722b3a75ca051c0e1f7b1261643815.zip
CMake-058b8a0bfb722b3a75ca051c0e1f7b1261643815.tar.gz
CMake-058b8a0bfb722b3a75ca051c0e1f7b1261643815.tar.bz2
install(): Properly ignore FILE_SETs that don't exist
Fixes: #22960
Diffstat (limited to 'Source/cmInstallCommand.cxx')
-rw-r--r--Source/cmInstallCommand.cxx43
1 files changed, 22 insertions, 21 deletions
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index a77b26b..8ce7ed1 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -1077,29 +1077,30 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
if (!namelinkOnly) {
for (std::size_t i = 0; i < fileSetArgs.size(); i++) {
- auto* fileSet = target.GetFileSet(fileSetArgs[i].GetFileSet());
- auto interfaceFileSetEntries = cmExpandedList(target.GetSafeProperty(
- cmTarget::GetInterfaceFileSetsPropertyName(fileSet->GetType())));
- if (fileSet &&
- std::find(
- interfaceFileSetEntries.begin(), interfaceFileSetEntries.end(),
- fileSetArgs[i].GetFileSet()) != interfaceFileSetEntries.end()) {
- std::string destination;
- if (fileSet->GetType() == "HEADERS"_s) {
- destination = helper.GetIncludeDestination(&fileSetArgs[i]);
- } else {
- destination = fileSetArgs[i].GetDestination();
- if (destination.empty()) {
- status.SetError(
- cmStrCat("TARGETS given no FILE_SET DESTINATION for target \"",
- target.GetName(), "\" file set \"",
- fileSet->GetName(), "\"."));
- return false;
+ if (auto* fileSet = target.GetFileSet(fileSetArgs[i].GetFileSet())) {
+ auto interfaceFileSetEntries = cmExpandedList(target.GetSafeProperty(
+ cmTarget::GetInterfaceFileSetsPropertyName(fileSet->GetType())));
+ if (std::find(interfaceFileSetEntries.begin(),
+ interfaceFileSetEntries.end(),
+ fileSetArgs[i].GetFileSet()) !=
+ interfaceFileSetEntries.end()) {
+ std::string destination;
+ if (fileSet->GetType() == "HEADERS"_s) {
+ destination = helper.GetIncludeDestination(&fileSetArgs[i]);
+ } else {
+ destination = fileSetArgs[i].GetDestination();
+ if (destination.empty()) {
+ status.SetError(cmStrCat(
+ "TARGETS given no FILE_SET DESTINATION for target \"",
+ target.GetName(), "\" file set \"", fileSet->GetName(),
+ "\"."));
+ return false;
+ }
}
+ fileSetGenerators.push_back(CreateInstallFileSetGenerator(
+ helper, target, fileSet, destination, fileSetArgs[i]));
+ installsFileSet[i] = true;
}
- fileSetGenerators.push_back(CreateInstallFileSetGenerator(
- helper, target, fileSet, destination, fileSetArgs[i]));
- installsFileSet[i] = true;
}
}
}