From 789138ae3ddddb45f8a2951d74fac7564266990e Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 16 Sep 2026 16:33:17 -0400 Subject: [PATCH] install(TARGETS): Avoid copying command arguments internally Follow up commit 21cc5937c1 (install(TARGETS): Factor out reusable helpers with config-specific support, 2026-09-10) to avoid copying the categorized argument groups unnecessarily. --- Source/cmInstallCommand.cxx | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 99e33ea5c7..a5c67976f2 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -1312,23 +1312,30 @@ bool HandleTargetsMode(std::vector const& args, } auto ctx = std::make_shared(); - ctx->GenericArgs = cm::make_unique(genericArgs); - ctx->ArchiveArgs = cm::make_unique(archiveArgs); - ctx->LibraryArgs = cm::make_unique(libraryArgs); - ctx->RuntimeArgs = cm::make_unique(runtimeArgs); - ctx->ObjectArgs = cm::make_unique(objectArgs); + ctx->GenericArgs = + cm::make_unique(std::move(genericArgs)); + ctx->ArchiveArgs = + cm::make_unique(std::move(archiveArgs)); + ctx->LibraryArgs = + cm::make_unique(std::move(libraryArgs)); + ctx->RuntimeArgs = + cm::make_unique(std::move(runtimeArgs)); + ctx->ObjectArgs = + cm::make_unique(std::move(objectArgs)); ctx->FrameworkArgs = - cm::make_unique(frameworkArgs); - ctx->BundleArgs = cm::make_unique(bundleArgs); + cm::make_unique(std::move(frameworkArgs)); + ctx->BundleArgs = + cm::make_unique(std::move(bundleArgs)); ctx->PrivateHeaderArgs = - cm::make_unique(privateHeaderArgs); + cm::make_unique(std::move(privateHeaderArgs)); ctx->PublicHeaderArgs = - cm::make_unique(publicHeaderArgs); - ctx->ResourceArgs = cm::make_unique(resourceArgs); + cm::make_unique(std::move(publicHeaderArgs)); + ctx->ResourceArgs = + cm::make_unique(std::move(resourceArgs)); ctx->CxxModuleBmiArgs = - cm::make_unique(cxxModuleBmiArgs); - ctx->IncludesArgs = includesArgs; - ctx->FileSetArgs = fileSetArgs; + cm::make_unique(std::move(cxxModuleBmiArgs)); + ctx->IncludesArgs = std::move(includesArgs); + ctx->FileSetArgs = std::move(fileSetArgs); ctx->NamelinkMode = namelinkMode; ctx->ImportlinkMode = importlinkMode; ctx->Exports = exports;