From 69ea84ec09aecd64b10c053cc3ecde18bfda2fa9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 10 Dec 2020 16:34:45 -0500 Subject: cmGlobalGenerator: Clear list of install components between runs --- Source/cmGlobalGenerator.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 9230091..ab76260 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1811,6 +1811,7 @@ void cmGlobalGenerator::ClearGeneratorMembers() this->AliasTargets.clear(); this->ExportSets.clear(); + this->InstallComponents.clear(); this->TargetDependencies.clear(); this->TargetSearchIndex.clear(); this->GeneratorTargetSearchIndex.clear(); -- cgit v0.12 From 6282a8e19057c2540cee91e894f01f599e205240 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 18 Jan 2021 16:40:48 -0500 Subject: cmInstallTargetGenerator: Move internal helper to anonymous namespace --- Source/cmInstallTargetGenerator.cxx | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index b3da202..8583216 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -25,6 +25,21 @@ #include "cmTarget.h" #include "cmake.h" +namespace { +std::string computeInstallObjectDir(cmGeneratorTarget* gt, + std::string const& config) +{ + std::string objectDir = "objects"; + if (!config.empty()) { + objectDir += "-"; + objectDir += config; + } + objectDir += "/"; + objectDir += gt->GetName(); + return objectDir; +} +} + cmInstallTargetGenerator::cmInstallTargetGenerator( std::string targetName, std::string const& dest, bool implib, std::string file_permissions, std::vector const& configurations, @@ -332,19 +347,6 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( &cmInstallTargetGenerator::PostReplacementTweaks); } -static std::string computeInstallObjectDir(cmGeneratorTarget* gt, - std::string const& config) -{ - std::string objectDir = "objects"; - if (!config.empty()) { - objectDir += "-"; - objectDir += config; - } - objectDir += "/"; - objectDir += gt->GetName(); - return objectDir; -} - void cmInstallTargetGenerator::GenerateScriptForConfigObjectLibrary( std::ostream& os, const std::string& config, Indent indent) { -- cgit v0.12 From c9e87e34479fb931c49c93bb8d9edefc3803adc4 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 18 Jan 2021 16:02:42 -0500 Subject: cmInstallTargetGenerator: Avoid duplicating install destination in memory --- Source/cmInstallTargetGenerator.cxx | 40 ++++++++++++++++++++----------------- Source/cmInstallTargetGenerator.h | 3 ++- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 8583216..e400252 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -112,9 +112,6 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( cmStrCat(this->Target->GetDirectory(config, artifact), '/'); } - std::string toDir = cmStrCat( - this->ConvertToAbsoluteDestination(this->GetDestination(config)), '/'); - // Compute the list of files to install for this target. std::vector filesFrom; std::vector filesTo; @@ -128,21 +125,21 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( this->Target->GetExecutableNames(config); if (this->ImportLibrary) { std::string from1 = fromDirConfig + targetNames.ImportLibrary; - std::string to1 = toDir + targetNames.ImportLibrary; + std::string to1 = targetNames.ImportLibrary; filesFrom.push_back(std::move(from1)); filesTo.push_back(std::move(to1)); std::string targetNameImportLib; if (this->Target->GetImplibGNUtoMS(config, targetNames.ImportLibrary, targetNameImportLib)) { filesFrom.push_back(fromDirConfig + targetNameImportLib); - filesTo.push_back(toDir + targetNameImportLib); + filesTo.push_back(targetNameImportLib); } // An import library looks like a static library. type = cmInstallType_STATIC_LIBRARY; } else { std::string from1 = fromDirConfig + targetNames.Output; - std::string to1 = toDir + targetNames.Output; + std::string to1 = targetNames.Output; // Handle OSX Bundles. if (this->Target->IsAppBundleOnApple()) { @@ -174,7 +171,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( // Tweaks apply to the real file, so list it first. if (targetNames.Real != targetNames.Output) { std::string from2 = fromDirConfig + targetNames.Real; - std::string to2 = toDir += targetNames.Real; + std::string to2 = targetNames.Real; filesFrom.push_back(std::move(from2)); filesTo.push_back(std::move(to2)); } @@ -191,14 +188,14 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( assert(this->NamelinkMode == NamelinkModeNone); std::string from1 = fromDirConfig + targetNames.ImportLibrary; - std::string to1 = toDir + targetNames.ImportLibrary; + std::string to1 = targetNames.ImportLibrary; filesFrom.push_back(std::move(from1)); filesTo.push_back(std::move(to1)); std::string targetNameImportLib; if (this->Target->GetImplibGNUtoMS(config, targetNames.ImportLibrary, targetNameImportLib)) { filesFrom.push_back(fromDirConfig + targetNameImportLib); - filesTo.push_back(toDir + targetNameImportLib); + filesTo.push_back(targetNameImportLib); } // An import library looks like a static library. @@ -241,7 +238,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( from1 = cmSystemTools::GetFilenamePath(from1); // Tweaks apply to the binary inside the bundle. - std::string to1 = toDir + targetNames.Real; + std::string to1 = targetNames.Real; filesFrom.push_back(std::move(from1)); filesTo.push_back(std::move(to1)); @@ -254,7 +251,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( targetNames.Output.substr(0, targetNames.Output.find('/')); std::string from1 = fromDirConfig + targetNameBase; - std::string to1 = toDir + targetNames.Output; + std::string to1 = targetNames.Output; filesFrom.push_back(std::move(from1)); filesTo.push_back(std::move(to1)); @@ -263,7 +260,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( // Library link name. std::string fromName = fromDirConfig + targetNames.Output; - std::string toName = toDir + targetNames.Output; + std::string toName = targetNames.Output; // Library interface name. std::string fromSOName; @@ -271,7 +268,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( if (targetNames.SharedObject != targetNames.Output) { haveNamelink = true; fromSOName = fromDirConfig + targetNames.SharedObject; - toSOName = toDir + targetNames.SharedObject; + toSOName = targetNames.SharedObject; } // Library implementation name. @@ -281,7 +278,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( targetNames.Real != targetNames.SharedObject) { haveNamelink = true; fromRealName = fromDirConfig + targetNames.Real; - toRealName = toDir + targetNames.Real; + toRealName = targetNames.Real; } // Add the names based on the current namelink mode. @@ -329,8 +326,12 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( return; } + // Tweak files located in the destination directory. + std::string toDir = cmStrCat( + this->ConvertToAbsoluteDestination(this->GetDestination(config)), '/'); + // Add pre-installation tweaks. - this->AddTweak(os, indent, config, filesTo, + this->AddTweak(os, indent, config, toDir, filesTo, &cmInstallTargetGenerator::PreReplacementTweaks); // Write code to install the target file. @@ -343,7 +344,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( indent); // Add post-installation tweaks. - this->AddTweak(os, indent, config, filesTo, + this->AddTweak(os, indent, config, toDir, filesTo, &cmInstallTargetGenerator::PostReplacementTweaks); } @@ -466,12 +467,14 @@ void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent indent, void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent indent, const std::string& config, + std::string const& dir, std::vector const& files, TweakMethod tweak) { if (files.size() == 1) { // Tweak a single file. - this->AddTweak(os, indent, config, this->GetDestDirPath(files[0]), tweak); + this->AddTweak(os, indent, config, + this->GetDestDirPath(cmStrCat(dir, files[0])), tweak); } else { // Generate a foreach loop to tweak multiple files. std::ostringstream tw; @@ -481,7 +484,8 @@ void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent indent, Indent indent2 = indent.Next().Next(); os << indent << "foreach(file\n"; for (std::string const& f : files) { - os << indent2 << "\"" << this->GetDestDirPath(f) << "\"\n"; + os << indent2 << "\"" << this->GetDestDirPath(cmStrCat(dir, f)) + << "\"\n"; } os << indent2 << ")\n"; os << tws; diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index a53a75a..fe54ca6 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -79,7 +79,8 @@ protected: void AddTweak(std::ostream& os, Indent indent, const std::string& config, std::string const& file, TweakMethod tweak); void AddTweak(std::ostream& os, Indent indent, const std::string& config, - std::vector const& files, TweakMethod tweak); + std::string const& dir, std::vector const& files, + TweakMethod tweak); std::string GetDestDirPath(std::string const& file); void PreReplacementTweaks(std::ostream& os, Indent indent, const std::string& config, -- cgit v0.12 From 599027622652421deca0ca9ef749a48a24eea509 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 18 Jan 2021 15:46:09 -0500 Subject: cmInstallTargetGenerator: Factor out method to get list of target files --- Source/cmInstallTargetGenerator.cxx | 202 +++++++++++++++++++----------------- Source/cmInstallTargetGenerator.h | 28 ++++- 2 files changed, 132 insertions(+), 98 deletions(-) diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index e400252..6b7d8bf 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -63,20 +63,69 @@ cmInstallTargetGenerator::~cmInstallTargetGenerator() = default; void cmInstallTargetGenerator::GenerateScriptForConfig( std::ostream& os, const std::string& config, Indent indent) { + // Compute the list of files to install for this target. + Files files = this->GetFiles(config); + + // Skip this rule if no files are to be installed for the target. + if (files.From.empty()) { + return; + } + + // Compute the effective install destination. + std::string dest = this->GetDestination(config); + if (!files.ToDir.empty()) { + dest = cmStrCat(dest, '/', files.ToDir); + } + + // Tweak files located in the destination directory. + std::string toDir = cmStrCat(this->ConvertToAbsoluteDestination(dest), '/'); + + // Add pre-installation tweaks. + if (!files.NoTweak) { + this->AddTweak(os, indent, config, toDir, files.To, + &cmInstallTargetGenerator::PreReplacementTweaks); + } + + // Write code to install the target file. + const char* no_dir_permissions = nullptr; + const char* no_rename = nullptr; + bool optional = this->Optional || this->ImportLibrary; + std::string literal_args; + if (!files.FromDir.empty()) { + literal_args += " FILES_FROM_DIR \"" + files.FromDir + "\""; + } + if (files.UseSourcePermissions) { + literal_args += " USE_SOURCE_PERMISSIONS"; + } + this->AddInstallRule(os, dest, files.Type, files.From, optional, + this->FilePermissions.c_str(), no_dir_permissions, + no_rename, literal_args.c_str(), indent); + + // Add post-installation tweaks. + if (!files.NoTweak) { + this->AddTweak(os, indent, config, toDir, files.To, + &cmInstallTargetGenerator::PostReplacementTweaks); + } +} + +cmInstallTargetGenerator::Files cmInstallTargetGenerator::GetFiles( + std::string const& config) const +{ + Files files; + cmStateEnums::TargetType targetType = this->Target->GetType(); - cmInstallType type = cmInstallType(); switch (targetType) { case cmStateEnums::EXECUTABLE: - type = cmInstallType_EXECUTABLE; + files.Type = cmInstallType_EXECUTABLE; break; case cmStateEnums::STATIC_LIBRARY: - type = cmInstallType_STATIC_LIBRARY; + files.Type = cmInstallType_STATIC_LIBRARY; break; case cmStateEnums::SHARED_LIBRARY: - type = cmInstallType_SHARED_LIBRARY; + files.Type = cmInstallType_SHARED_LIBRARY; break; case cmStateEnums::MODULE_LIBRARY: - type = cmInstallType_MODULE_LIBRARY; + files.Type = cmInstallType_MODULE_LIBRARY; break; case cmStateEnums::INTERFACE_LIBRARY: // Not reachable. We never create a cmInstallTargetGenerator for @@ -85,9 +134,21 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( "INTERFACE_LIBRARY targets have no installable outputs."); break; - case cmStateEnums::OBJECT_LIBRARY: - this->GenerateScriptForConfigObjectLibrary(os, config, indent); - return; + case cmStateEnums::OBJECT_LIBRARY: { + // Compute all the object files inside this target + std::vector objects; + this->Target->GetTargetObjectNames(config, objects); + + files.Type = cmInstallType_FILES; + files.NoTweak = true; + files.FromDir = this->Target->GetObjectDirectory(config); + files.ToDir = computeInstallObjectDir(this->Target, config); + for (std::string& obj : objects) { + files.From.emplace_back(obj); + files.To.emplace_back(std::move(obj)); + } + return files; + } case cmStateEnums::UTILITY: case cmStateEnums::GLOBAL_TARGET: @@ -95,7 +156,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( this->Target->GetLocalGenerator()->IssueMessage( MessageType::INTERNAL_ERROR, "cmInstallTargetGenerator created with non-installable target."); - return; + return files; } // Compute the build tree directory from which to copy the target. @@ -112,11 +173,6 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( cmStrCat(this->Target->GetDirectory(config, artifact), '/'); } - // Compute the list of files to install for this target. - std::vector filesFrom; - std::vector filesTo; - std::string literal_args; - if (targetType == cmStateEnums::EXECUTABLE) { // There is a bug in cmInstallCommand if this fails. assert(this->NamelinkMode == NamelinkModeNone); @@ -126,17 +182,17 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( if (this->ImportLibrary) { std::string from1 = fromDirConfig + targetNames.ImportLibrary; std::string to1 = targetNames.ImportLibrary; - filesFrom.push_back(std::move(from1)); - filesTo.push_back(std::move(to1)); + files.From.emplace_back(std::move(from1)); + files.To.emplace_back(std::move(to1)); std::string targetNameImportLib; if (this->Target->GetImplibGNUtoMS(config, targetNames.ImportLibrary, targetNameImportLib)) { - filesFrom.push_back(fromDirConfig + targetNameImportLib); - filesTo.push_back(targetNameImportLib); + files.From.emplace_back(fromDirConfig + targetNameImportLib); + files.To.emplace_back(targetNameImportLib); } // An import library looks like a static library. - type = cmInstallType_STATIC_LIBRARY; + files.Type = cmInstallType_STATIC_LIBRARY; } else { std::string from1 = fromDirConfig + targetNames.Output; std::string to1 = targetNames.Output; @@ -154,8 +210,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( } // Install the whole app bundle directory. - type = cmInstallType_DIRECTORY; - literal_args += " USE_SOURCE_PERMISSIONS"; + files.Type = cmInstallType_DIRECTORY; + files.UseSourcePermissions = true; from1 += "."; from1 += ext; @@ -172,13 +228,13 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( if (targetNames.Real != targetNames.Output) { std::string from2 = fromDirConfig + targetNames.Real; std::string to2 = targetNames.Real; - filesFrom.push_back(std::move(from2)); - filesTo.push_back(std::move(to2)); + files.From.emplace_back(std::move(from2)); + files.To.emplace_back(std::move(to2)); } } - filesFrom.push_back(std::move(from1)); - filesTo.push_back(std::move(to1)); + files.From.emplace_back(std::move(from1)); + files.To.emplace_back(std::move(to1)); } } else { cmGeneratorTarget::Names targetNames = @@ -189,17 +245,17 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( std::string from1 = fromDirConfig + targetNames.ImportLibrary; std::string to1 = targetNames.ImportLibrary; - filesFrom.push_back(std::move(from1)); - filesTo.push_back(std::move(to1)); + files.From.emplace_back(std::move(from1)); + files.To.emplace_back(std::move(to1)); std::string targetNameImportLib; if (this->Target->GetImplibGNUtoMS(config, targetNames.ImportLibrary, targetNameImportLib)) { - filesFrom.push_back(fromDirConfig + targetNameImportLib); - filesTo.push_back(targetNameImportLib); + files.From.emplace_back(fromDirConfig + targetNameImportLib); + files.To.emplace_back(targetNameImportLib); } // An import library looks like a static library. - type = cmInstallType_STATIC_LIBRARY; + files.Type = cmInstallType_STATIC_LIBRARY; } else if (this->Target->IsFrameworkOnApple()) { // FIXME: In principle we should be able to // assert(this->NamelinkMode == NamelinkModeNone); @@ -219,7 +275,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( break; case NamelinkModeOnly: // Assume the NamelinkModeSkip instance will warn and install. - return; + return files; case NamelinkModeSkip: { std::string e = "Target '" + this->Target->GetName() + "' was changed to a FRAMEWORK sometime after install(). " @@ -231,8 +287,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( } // Install the whole framework directory. - type = cmInstallType_DIRECTORY; - literal_args += " USE_SOURCE_PERMISSIONS"; + files.Type = cmInstallType_DIRECTORY; + files.UseSourcePermissions = true; std::string from1 = fromDirConfig + targetNames.Output; from1 = cmSystemTools::GetFilenamePath(from1); @@ -240,12 +296,12 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( // Tweaks apply to the binary inside the bundle. std::string to1 = targetNames.Real; - filesFrom.push_back(std::move(from1)); - filesTo.push_back(std::move(to1)); + files.From.emplace_back(std::move(from1)); + files.To.emplace_back(std::move(to1)); } else if (this->Target->IsCFBundleOnApple()) { // Install the whole app bundle directory. - type = cmInstallType_DIRECTORY; - literal_args += " USE_SOURCE_PERMISSIONS"; + files.Type = cmInstallType_DIRECTORY; + files.UseSourcePermissions = true; std::string targetNameBase = targetNames.Output.substr(0, targetNames.Output.find('/')); @@ -253,8 +309,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( std::string from1 = fromDirConfig + targetNameBase; std::string to1 = targetNames.Output; - filesFrom.push_back(std::move(from1)); - filesTo.push_back(std::move(to1)); + files.From.emplace_back(std::move(from1)); + files.To.emplace_back(std::move(to1)); } else { bool haveNamelink = false; @@ -286,86 +342,42 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( // With a namelink we need to check the mode. if (this->NamelinkMode == NamelinkModeOnly) { // Install the namelink only. - filesFrom.push_back(fromName); - filesTo.push_back(toName); + files.From.emplace_back(fromName); + files.To.emplace_back(toName); } else { // Install the real file if it has its own name. if (!fromRealName.empty()) { - filesFrom.push_back(fromRealName); - filesTo.push_back(toRealName); + files.From.emplace_back(fromRealName); + files.To.emplace_back(toRealName); } // Install the soname link if it has its own name. if (!fromSOName.empty()) { - filesFrom.push_back(fromSOName); - filesTo.push_back(toSOName); + files.From.emplace_back(fromSOName); + files.To.emplace_back(toSOName); } // Install the namelink if it is not to be skipped. if (this->NamelinkMode != NamelinkModeSkip) { - filesFrom.push_back(fromName); - filesTo.push_back(toName); + files.From.emplace_back(fromName); + files.To.emplace_back(toName); } } } else { // Without a namelink there will be only one file. Install it // if this is not a namelink-only rule. if (this->NamelinkMode != NamelinkModeOnly) { - filesFrom.push_back(fromName); - filesTo.push_back(toName); + files.From.emplace_back(fromName); + files.To.emplace_back(toName); } } } } // If this fails the above code is buggy. - assert(filesFrom.size() == filesTo.size()); - - // Skip this rule if no files are to be installed for the target. - if (filesFrom.empty()) { - return; - } - - // Tweak files located in the destination directory. - std::string toDir = cmStrCat( - this->ConvertToAbsoluteDestination(this->GetDestination(config)), '/'); - - // Add pre-installation tweaks. - this->AddTweak(os, indent, config, toDir, filesTo, - &cmInstallTargetGenerator::PreReplacementTweaks); + assert(files.From.size() == files.To.size()); - // Write code to install the target file. - const char* no_dir_permissions = nullptr; - const char* no_rename = nullptr; - bool optional = this->Optional || this->ImportLibrary; - this->AddInstallRule(os, this->GetDestination(config), type, filesFrom, - optional, this->FilePermissions.c_str(), - no_dir_permissions, no_rename, literal_args.c_str(), - indent); - - // Add post-installation tweaks. - this->AddTweak(os, indent, config, toDir, filesTo, - &cmInstallTargetGenerator::PostReplacementTweaks); -} - -void cmInstallTargetGenerator::GenerateScriptForConfigObjectLibrary( - std::ostream& os, const std::string& config, Indent indent) -{ - // Compute all the object files inside this target - std::vector objects; - this->Target->GetTargetObjectNames(config, objects); - - std::string const dest = this->GetDestination(config) + "/" + - computeInstallObjectDir(this->Target, config); - - std::string const obj_dir = this->Target->GetObjectDirectory(config); - std::string const literal_args = " FILES_FROM_DIR \"" + obj_dir + "\""; - - const char* no_dir_permissions = nullptr; - const char* no_rename = nullptr; - this->AddInstallRule(os, dest, cmInstallType_FILES, objects, this->Optional, - this->FilePermissions.c_str(), no_dir_permissions, - no_rename, literal_args.c_str(), indent); + return files; } void cmInstallTargetGenerator::GetInstallObjectNames( diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index fe54ca6..512394a 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -9,6 +9,7 @@ #include #include "cmInstallGenerator.h" +#include "cmInstallType.h" #include "cmListFileCache.h" #include "cmScriptGenerator.h" @@ -67,12 +68,33 @@ public: cmListFileBacktrace const& GetBacktrace() const { return this->Backtrace; } + struct Files + { + // Names or paths of files to be read from the source or build tree. + // The paths may be computed as [FromDir/] + From[i]. + std::vector From; + + // Corresponding names of files to be written in the install directory. + // The paths may be computed as Destination/ + [ToDir/] + To[i]. + std::vector To; + + // Prefix for all files in From. + std::string FromDir; + + // Prefix for all files in To. + std::string ToDir; + + bool NoTweak = false; + bool UseSourcePermissions = false; + cmInstallType Type = cmInstallType(); + }; + Files GetFiles(std::string const& config) const; + + bool GetOptional() const { return this->Optional; } + protected: void GenerateScriptForConfig(std::ostream& os, const std::string& config, Indent indent) override; - void GenerateScriptForConfigObjectLibrary(std::ostream& os, - const std::string& config, - Indent indent); using TweakMethod = void (cmInstallTargetGenerator::*)(std::ostream&, Indent, const std::string&, const std::string&); -- cgit v0.12 From 5b23d8a7b1e913df8261895f77a2140199a0b812 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 11 Jan 2021 10:07:27 -0500 Subject: cmInstallFilesGenerator: Factor out method to get list of files --- Source/cmInstallFilesGenerator.cxx | 22 +++++++++++++++++----- Source/cmInstallFilesGenerator.h | 2 ++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index 0a353e4..1d816b7 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -66,6 +66,22 @@ std::string cmInstallFilesGenerator::GetRename(std::string const& config) const config); } +std::vector cmInstallFilesGenerator::GetFiles( + std::string const& config) const +{ + std::vector files; + if (this->ActionsPerConfig) { + for (std::string const& f : this->Files) { + cmExpandList( + cmGeneratorExpression::Evaluate(f, this->LocalGenerator, config), + files); + } + } else { + files = this->Files; + } + return files; +} + void cmInstallFilesGenerator::AddFilesInstallRule( std::ostream& os, std::string const& config, Indent indent, std::vector const& files) @@ -92,10 +108,6 @@ void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os, void cmInstallFilesGenerator::GenerateScriptForConfig( std::ostream& os, const std::string& config, Indent indent) { - std::vector files; - for (std::string const& f : this->Files) { - cmExpandList( - cmGeneratorExpression::Evaluate(f, this->LocalGenerator, config), files); - } + std::vector files = this->GetFiles(config); this->AddFilesInstallRule(os, config, indent, files); } diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index 66145f4..7438440 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -32,6 +32,8 @@ public: std::string GetDestination(std::string const& config) const; std::string GetRename(std::string const& config) const; + std::vector GetFiles(std::string const& config) const; + bool GetOptional() const { return this->Optional; } protected: void GenerateScriptActions(std::ostream& os, Indent indent) override; -- cgit v0.12 From 2452cfdeab0a4c07a84b0908f4d4ecee79861ec8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 11 Jan 2021 10:27:50 -0500 Subject: cmInstallDirectoryGenerator: Factor out method to get list of directories --- Source/cmInstallDirectoryGenerator.cxx | 22 +++++++++++++++++----- Source/cmInstallDirectoryGenerator.h | 3 +++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index 0b45f28..2c5b9c6 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -50,6 +50,22 @@ bool cmInstallDirectoryGenerator::Compute(cmLocalGenerator* lg) return true; } +std::vector cmInstallDirectoryGenerator::GetDirectories( + std::string const& config) const +{ + std::vector directories; + if (this->ActionsPerConfig) { + for (std::string const& f : this->Directories) { + cmExpandList( + cmGeneratorExpression::Evaluate(f, this->LocalGenerator, config), + directories); + } + } else { + directories = this->Directories; + } + return directories; +} + void cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os, Indent indent) { @@ -63,11 +79,7 @@ void cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os, void cmInstallDirectoryGenerator::GenerateScriptForConfig( std::ostream& os, const std::string& config, Indent indent) { - std::vector dirs; - for (std::string const& d : this->Directories) { - cmExpandList( - cmGeneratorExpression::Evaluate(d, this->LocalGenerator, config), dirs); - } + std::vector dirs = this->GetDirectories(config); // Make sure all dirs have absolute paths. cmMakefile const& mf = *this->LocalGenerator->GetMakefile(); diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h index af310f3..7c707bd 100644 --- a/Source/cmInstallDirectoryGenerator.h +++ b/Source/cmInstallDirectoryGenerator.h @@ -32,6 +32,9 @@ public: bool Compute(cmLocalGenerator* lg) override; std::string GetDestination(std::string const& config) const; + std::vector GetDirectories(std::string const& config) const; + + bool GetOptional() const { return this->Optional; } protected: void GenerateScriptActions(std::ostream& os, Indent indent) override; -- cgit v0.12 From 121509250734f420cd48a64e171ba155ade3cd59 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 11 Jan 2021 11:05:43 -0500 Subject: cmInstallScriptGenerator: Factor out method to get script --- Source/cmInstallScriptGenerator.cxx | 21 ++++++++++++++------- Source/cmInstallScriptGenerator.h | 4 ++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index 5b01791..80b7860 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -53,6 +53,19 @@ bool cmInstallScriptGenerator::Compute(cmLocalGenerator* lg) return true; } +std::string cmInstallScriptGenerator::GetScript( + std::string const& config) const +{ + std::string script; + if (this->AllowGenex && this->ActionsPerConfig) { + script = cmGeneratorExpression::Evaluate(this->Script, + this->LocalGenerator, config); + } else { + script = this->Script; + } + return script; +} + void cmInstallScriptGenerator::AddScriptInstallRule( std::ostream& os, Indent indent, std::string const& script) const { @@ -76,11 +89,5 @@ void cmInstallScriptGenerator::GenerateScriptActions(std::ostream& os, void cmInstallScriptGenerator::GenerateScriptForConfig( std::ostream& os, const std::string& config, Indent indent) { - if (this->AllowGenex) { - this->AddScriptInstallRule(os, indent, - cmGeneratorExpression::Evaluate( - this->Script, this->LocalGenerator, config)); - } else { - this->AddScriptInstallRule(os, indent, this->Script); - } + this->AddScriptInstallRule(os, indent, this->GetScript(config)); } diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h index f7ee3f9..6f0c837 100644 --- a/Source/cmInstallScriptGenerator.h +++ b/Source/cmInstallScriptGenerator.h @@ -25,6 +25,10 @@ public: bool Compute(cmLocalGenerator* lg) override; + bool IsCode() const { return this->Code; } + + std::string GetScript(std::string const& config) const; + protected: void GenerateScriptActions(std::ostream& os, Indent indent) override; void GenerateScriptForConfig(std::ostream& os, const std::string& config, -- cgit v0.12 From eea61268e6f755e70a91770f7f512e29bc6a288c Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 11 Jan 2021 11:07:26 -0500 Subject: cmInstallExportGenerator: Add method to get installed file name --- Source/cmInstallExportGenerator.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index dd8624b..1f038cf 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -44,8 +44,11 @@ public: const std::string& GetNamespace() const { return this->Namespace; } + std::string const& GetMainImportFile() const { return this->MainImportFile; } + std::string const& GetDestination() const { return this->Destination; } std::string GetDestinationFile() const; + std::string GetFileName() const { return this->FileName; } protected: void GenerateScript(std::ostream& os) override; -- cgit v0.12 From e32818dd76879d43b4cd84f7f72cd3f83dbecbd6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 11 Jan 2021 09:58:55 -0500 Subject: cmInstallGenerator: Add backtrace to all install generators --- Source/cmInstallCommand.cxx | 22 ++++++++++++++-------- Source/cmInstallDirectoryGenerator.cxx | 4 ++-- Source/cmInstallDirectoryGenerator.h | 15 +++++++-------- Source/cmInstallExportGenerator.cxx | 5 +++-- Source/cmInstallExportGenerator.h | 3 ++- Source/cmInstallFilesCommand.cxx | 2 +- Source/cmInstallFilesGenerator.cxx | 4 ++-- Source/cmInstallFilesGenerator.h | 3 ++- Source/cmInstallGenerator.cxx | 4 +++- Source/cmInstallGenerator.h | 6 +++++- Source/cmInstallProgramsCommand.cxx | 2 +- Source/cmInstallScriptGenerator.cxx | 4 ++-- Source/cmInstallScriptGenerator.h | 8 +++++--- Source/cmInstallSubdirectoryGenerator.cxx | 5 +++-- Source/cmInstallSubdirectoryGenerator.h | 4 +++- Source/cmInstallTargetGenerator.cxx | 3 +-- Source/cmInstallTargetGenerator.h | 3 --- Source/cmMakefile.cxx | 2 +- 18 files changed, 57 insertions(+), 42 deletions(-) diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index b04ad0c..7788db3 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -133,7 +133,8 @@ std::unique_ptr CreateInstallFilesGenerator( return cm::make_unique( absFiles, destination, programs, args.GetPermissions(), args.GetConfigurations(), args.GetComponent(), message, - args.GetExcludeFromAll(), args.GetRename(), args.GetOptional()); + args.GetExcludeFromAll(), args.GetRename(), args.GetOptional(), + mf->GetBacktrace()); } std::unique_ptr CreateInstallFilesGenerator( @@ -206,14 +207,16 @@ bool HandleScriptMode(std::vector const& args, return false; } helper.Makefile->AddInstallGenerator( - cm::make_unique(script, false, component, - exclude_from_all)); + cm::make_unique( + script, false, component, exclude_from_all, + helper.Makefile->GetBacktrace())); } else if (doing_code) { doing_code = false; std::string const& code = arg; helper.Makefile->AddInstallGenerator( - cm::make_unique(code, true, component, - exclude_from_all)); + cm::make_unique( + code, true, component, exclude_from_all, + helper.Makefile->GetBacktrace())); } } @@ -1253,7 +1256,8 @@ bool HandleDirectoryMode(std::vector const& args, helper.Makefile->AddInstallGenerator( cm::make_unique( dirs, *destination, permissions_file, permissions_dir, configurations, - component, message, exclude_from_all, literal_args, optional)); + component, message, exclude_from_all, literal_args, optional, + helper.Makefile->GetBacktrace())); // Tell the global generator about any installation component names // specified. @@ -1345,7 +1349,8 @@ bool HandleExportAndroidMKMode(std::vector const& args, cm::make_unique( &exportSet, ica.GetDestination(), ica.GetPermissions(), ica.GetConfigurations(), ica.GetComponent(), message, - ica.GetExcludeFromAll(), fname, name_space, exportOld, true)); + ica.GetExcludeFromAll(), fname, name_space, exportOld, true, + helper.Makefile->GetBacktrace())); return true; #else @@ -1458,7 +1463,8 @@ bool HandleExportMode(std::vector const& args, cm::make_unique( &exportSet, ica.GetDestination(), ica.GetPermissions(), ica.GetConfigurations(), ica.GetComponent(), message, - ica.GetExcludeFromAll(), fname, name_space, exportOld, false)); + ica.GetExcludeFromAll(), fname, name_space, exportOld, false, + helper.Makefile->GetBacktrace())); return true; } diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index 2c5b9c6..4eb5f69 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -16,9 +16,9 @@ cmInstallDirectoryGenerator::cmInstallDirectoryGenerator( std::string file_permissions, std::string dir_permissions, std::vector const& configurations, std::string const& component, MessageLevel message, bool exclude_from_all, std::string literal_args, - bool optional) + bool optional, cmListFileBacktrace backtrace) : cmInstallGenerator(dest, configurations, component, message, - exclude_from_all) + exclude_from_all, std::move(backtrace)) , LocalGenerator(nullptr) , Directories(dirs) , FilePermissions(std::move(file_permissions)) diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h index 7c707bd..0f91a59 100644 --- a/Source/cmInstallDirectoryGenerator.h +++ b/Source/cmInstallDirectoryGenerator.h @@ -9,6 +9,7 @@ #include #include "cmInstallGenerator.h" +#include "cmListFileCache.h" #include "cmScriptGenerator.h" class cmLocalGenerator; @@ -19,14 +20,12 @@ class cmLocalGenerator; class cmInstallDirectoryGenerator : public cmInstallGenerator { public: - cmInstallDirectoryGenerator(std::vector const& dirs, - std::string const& dest, - std::string file_permissions, - std::string dir_permissions, - std::vector const& configurations, - std::string const& component, - MessageLevel message, bool exclude_from_all, - std::string literal_args, bool optional = false); + cmInstallDirectoryGenerator( + std::vector const& dirs, std::string const& dest, + std::string file_permissions, std::string dir_permissions, + std::vector const& configurations, + std::string const& component, MessageLevel message, bool exclude_from_all, + std::string literal_args, bool optional, cmListFileBacktrace backtrace); ~cmInstallDirectoryGenerator() override; bool Compute(cmLocalGenerator* lg) override; diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 3683ada..fdc3f8c 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -23,9 +23,10 @@ cmInstallExportGenerator::cmInstallExportGenerator( cmExportSet* exportSet, std::string const& destination, std::string file_permissions, std::vector const& configurations, std::string const& component, MessageLevel message, bool exclude_from_all, - std::string filename, std::string name_space, bool exportOld, bool android) + std::string filename, std::string name_space, bool exportOld, bool android, + cmListFileBacktrace backtrace) : cmInstallGenerator(destination, configurations, component, message, - exclude_from_all) + exclude_from_all, std::move(backtrace)) , ExportSet(exportSet) , FilePermissions(std::move(file_permissions)) , FileName(std::move(filename)) diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index 1f038cf..efeae86 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -11,6 +11,7 @@ #include #include "cmInstallGenerator.h" +#include "cmListFileCache.h" #include "cmScriptGenerator.h" class cmExportInstallFileGenerator; @@ -29,7 +30,7 @@ public: std::string const& component, MessageLevel message, bool exclude_from_all, std::string filename, std::string name_space, bool exportOld, - bool android); + bool android, cmListFileBacktrace backtrace); cmInstallExportGenerator(const cmInstallExportGenerator&) = delete; ~cmInstallExportGenerator() override; diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 3c59f01..e65cb24 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -125,7 +125,7 @@ static void CreateInstallGenerator(cmMakefile& makefile, cmInstallGenerator::SelectMessageLevel(&makefile); makefile.AddInstallGenerator(cm::make_unique( files, destination, false, no_permissions, no_configurations, no_component, - message, no_exclude_from_all, no_rename)); + message, no_exclude_from_all, no_rename, false, makefile.GetBacktrace())); } /** diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index 1d816b7..556c938 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -15,9 +15,9 @@ cmInstallFilesGenerator::cmInstallFilesGenerator( bool programs, std::string file_permissions, std::vector const& configurations, std::string const& component, MessageLevel message, bool exclude_from_all, std::string rename, - bool optional) + bool optional, cmListFileBacktrace backtrace) : cmInstallGenerator(dest, configurations, component, message, - exclude_from_all) + exclude_from_all, std::move(backtrace)) , LocalGenerator(nullptr) , Files(files) , FilePermissions(std::move(file_permissions)) diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index 7438440..af7f113 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -9,6 +9,7 @@ #include #include "cmInstallGenerator.h" +#include "cmListFileCache.h" #include "cmScriptGenerator.h" class cmLocalGenerator; @@ -25,7 +26,7 @@ public: std::vector const& configurations, std::string const& component, MessageLevel message, bool exclude_from_all, std::string rename, - bool optional = false); + bool optional, cmListFileBacktrace backtrace); ~cmInstallFilesGenerator() override; bool Compute(cmLocalGenerator* lg) override; diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index 0665895..98e3766 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -10,12 +10,14 @@ cmInstallGenerator::cmInstallGenerator( std::string destination, std::vector const& configurations, - std::string component, MessageLevel message, bool exclude_from_all) + std::string component, MessageLevel message, bool exclude_from_all, + cmListFileBacktrace backtrace) : cmScriptGenerator("CMAKE_INSTALL_CONFIG_NAME", configurations) , Destination(std::move(destination)) , Component(std::move(component)) , Message(message) , ExcludeFromAll(exclude_from_all) + , Backtrace(std::move(backtrace)) { } diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index ee55ee9..64ee9ed 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -9,6 +9,7 @@ #include #include "cmInstallType.h" +#include "cmListFileCache.h" #include "cmScriptGenerator.h" class cmLocalGenerator; @@ -32,7 +33,7 @@ public: cmInstallGenerator(std::string destination, std::vector const& configurations, std::string component, MessageLevel message, - bool exclude_from_all); + bool exclude_from_all, cmListFileBacktrace backtrace); ~cmInstallGenerator() override; cmInstallGenerator(cmInstallGenerator const&) = delete; @@ -61,6 +62,8 @@ public: virtual bool Compute(cmLocalGenerator*) { return true; } + cmListFileBacktrace const& GetBacktrace() const { return this->Backtrace; } + protected: void GenerateScript(std::ostream& os) override; @@ -72,4 +75,5 @@ protected: std::string const Component; MessageLevel const Message; bool const ExcludeFromAll; + cmListFileBacktrace const Backtrace; }; diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index be07fd4..65b8d89 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -99,7 +99,7 @@ static void FinalAction(cmMakefile& makefile, std::string const& dest, cmInstallGenerator::SelectMessageLevel(&makefile); makefile.AddInstallGenerator(cm::make_unique( files, destination, true, no_permissions, no_configurations, no_component, - message, no_exclude_from_all, no_rename)); + message, no_exclude_from_all, no_rename, false, makefile.GetBacktrace())); } /** diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index 80b7860..bb38990 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -14,9 +14,9 @@ cmInstallScriptGenerator::cmInstallScriptGenerator( std::string script, bool code, std::string const& component, - bool exclude_from_all) + bool exclude_from_all, cmListFileBacktrace backtrace) : cmInstallGenerator("", std::vector(), component, - MessageDefault, exclude_from_all) + MessageDefault, exclude_from_all, std::move(backtrace)) , Script(std::move(script)) , Code(code) , AllowGenex(false) diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h index 6f0c837..6274f1c 100644 --- a/Source/cmInstallScriptGenerator.h +++ b/Source/cmInstallScriptGenerator.h @@ -8,6 +8,7 @@ #include #include "cmInstallGenerator.h" +#include "cmListFileCache.h" #include "cmScriptGenerator.h" class cmLocalGenerator; @@ -18,9 +19,10 @@ class cmLocalGenerator; class cmInstallScriptGenerator : public cmInstallGenerator { public: - cmInstallScriptGenerator(std::string script, bool code, - std::string const& component, - bool exclude_from_all); + cmInstallScriptGenerator( + std::string script, bool code, std::string const& component, + bool exclude_from_all, + cmListFileBacktrace backtrace = cmListFileBacktrace()); ~cmInstallScriptGenerator() override; bool Compute(cmLocalGenerator* lg) override; diff --git a/Source/cmInstallSubdirectoryGenerator.cxx b/Source/cmInstallSubdirectoryGenerator.cxx index 12bc92b..76806e5 100644 --- a/Source/cmInstallSubdirectoryGenerator.cxx +++ b/Source/cmInstallSubdirectoryGenerator.cxx @@ -14,9 +14,10 @@ #include "cmSystemTools.h" cmInstallSubdirectoryGenerator::cmInstallSubdirectoryGenerator( - cmMakefile* makefile, std::string binaryDirectory, bool excludeFromAll) + cmMakefile* makefile, std::string binaryDirectory, bool excludeFromAll, + cmListFileBacktrace backtrace) : cmInstallGenerator("", std::vector(), "", MessageDefault, - excludeFromAll) + excludeFromAll, std::move(backtrace)) , Makefile(makefile) , BinaryDirectory(std::move(binaryDirectory)) { diff --git a/Source/cmInstallSubdirectoryGenerator.h b/Source/cmInstallSubdirectoryGenerator.h index 3e46d6b..614cef9 100644 --- a/Source/cmInstallSubdirectoryGenerator.h +++ b/Source/cmInstallSubdirectoryGenerator.h @@ -8,6 +8,7 @@ #include #include "cmInstallGenerator.h" +#include "cmListFileCache.h" class cmLocalGenerator; class cmMakefile; @@ -20,7 +21,8 @@ class cmInstallSubdirectoryGenerator : public cmInstallGenerator public: cmInstallSubdirectoryGenerator(cmMakefile* makefile, std::string binaryDirectory, - bool excludeFromAll); + bool excludeFromAll, + cmListFileBacktrace backtrace); ~cmInstallSubdirectoryGenerator() override; bool HaveInstall() override; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 6b7d8bf..bef785d 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -46,13 +46,12 @@ cmInstallTargetGenerator::cmInstallTargetGenerator( std::string const& component, MessageLevel message, bool exclude_from_all, bool optional, cmListFileBacktrace backtrace) : cmInstallGenerator(dest, configurations, component, message, - exclude_from_all) + exclude_from_all, std::move(backtrace)) , TargetName(std::move(targetName)) , Target(nullptr) , FilePermissions(std::move(file_permissions)) , ImportLibrary(implib) , Optional(optional) - , Backtrace(std::move(backtrace)) { this->ActionsPerConfig = true; this->NamelinkMode = NamelinkModeNone; diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 512394a..8c5d444 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -66,8 +66,6 @@ public: std::string GetDestination(std::string const& config) const; - cmListFileBacktrace const& GetBacktrace() const { return this->Backtrace; } - struct Files { // Names or paths of files to be read from the source or build tree. @@ -134,5 +132,4 @@ protected: NamelinkModeType NamelinkMode; bool const ImportLibrary; bool const Optional; - cmListFileBacktrace const Backtrace; }; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0fc8fa3..f479af1 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1838,7 +1838,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, } this->AddInstallGenerator(cm::make_unique( - subMf, binPath, excludeFromAll)); + subMf, binPath, excludeFromAll, this->GetBacktrace())); } const std::string& cmMakefile::GetCurrentSourceDirectory() const -- cgit v0.12 From 203cc694ddb58512499ef8983f6ff0d725e9fb5b Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 14 Jan 2021 15:49:25 -0500 Subject: cmInstallGenerator: Add accessors for settings common to all installers --- Source/cmInstallGenerator.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index 64ee9ed..6cd9ff9 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -62,6 +62,10 @@ public: virtual bool Compute(cmLocalGenerator*) { return true; } + std::string const& GetComponent() const { return this->Component; } + + bool GetExcludeFromAll() const { return this->ExcludeFromAll; } + cmListFileBacktrace const& GetBacktrace() const { return this->Backtrace; } protected: -- cgit v0.12