cmExportFileGenerator: Simplify collection of targets missing from export set

Store the list of missing target names in a member instead of threading
an explicit reference to it through the call stack.
This commit is contained in:
Brad King
2022-04-11 11:06:28 -04:00
parent 7fc248bde3
commit 8c65b7042e
11 changed files with 117 additions and 157 deletions
+20 -29
View File
@@ -66,8 +66,7 @@ protected:
// Generate per-configuration target information to the given output
// stream.
void GenerateImportConfig(std::ostream& os, const std::string& config,
std::vector<std::string>& missingTargets);
void GenerateImportConfig(std::ostream& os, const std::string& config);
// Methods to implement export file code generation.
virtual void GeneratePolicyHeaderCode(std::ostream& os);
@@ -88,8 +87,7 @@ protected:
ImportPropertyMap const& properties,
const std::set<std::string>& importedLocations);
virtual void GenerateImportedFileCheckLoop(std::ostream& os);
virtual void GenerateMissingTargetsCheckCode(
std::ostream& os, const std::vector<std::string>& missingTargets);
virtual void GenerateMissingTargetsCheckCode(std::ostream& os);
virtual void GenerateExpectedTargetsCode(std::ostream& os,
const std::string& expectedTargets);
@@ -99,8 +97,7 @@ protected:
void SetImportDetailProperties(const std::string& config,
std::string const& suffix,
cmGeneratorTarget* target,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
ImportPropertyMap& properties);
enum class ImportLinkPropertyTargetNames
{
@@ -113,31 +110,28 @@ protected:
const std::string& propName,
std::vector<T> const& entries,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets,
ImportLinkPropertyTargetNames targetNames);
/** Each subclass knows how to generate its kind of export file. */
virtual bool GenerateMainFile(std::ostream& os) = 0;
/** Each subclass knows where the target files are located. */
virtual void GenerateImportTargetsConfig(
std::ostream& os, const std::string& config, std::string const& suffix,
std::vector<std::string>& missingTargets) = 0;
virtual void GenerateImportTargetsConfig(std::ostream& os,
const std::string& config,
std::string const& suffix) = 0;
/** Each subclass knows how to deal with a target that is missing from an
* export set. */
virtual void HandleMissingTarget(std::string& link_libs,
std::vector<std::string>& missingTargets,
cmGeneratorTarget const* depender,
cmGeneratorTarget* dependee) = 0;
void PopulateInterfaceProperty(const std::string&,
cmGeneratorTarget const* target,
cmGeneratorExpression::PreprocessContext,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
ImportPropertyMap& properties);
bool PopulateInterfaceLinkLibrariesProperty(
cmGeneratorTarget const* target, cmGeneratorExpression::PreprocessContext,
ImportPropertyMap& properties, std::vector<std::string>& missingTargets);
ImportPropertyMap& properties);
void PopulateInterfaceProperty(const std::string& propName,
cmGeneratorTarget const* target,
ImportPropertyMap& properties);
@@ -149,26 +143,24 @@ protected:
void PopulateIncludeDirectoriesInterface(
cmGeneratorTarget const* target,
cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap& properties, std::vector<std::string>& missingTargets,
cmTargetExport const& te);
ImportPropertyMap& properties, cmTargetExport const& te);
void PopulateSourcesInterface(
cmGeneratorTarget const* target,
cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap& properties, std::vector<std::string>& missingTargets);
ImportPropertyMap& properties);
void PopulateLinkDirectoriesInterface(
cmGeneratorTarget const* target,
cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap& properties, std::vector<std::string>& missingTargets);
ImportPropertyMap& properties);
void PopulateLinkDependsInterface(
cmGeneratorTarget const* target,
cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap& properties, std::vector<std::string>& missingTargets);
ImportPropertyMap& properties);
void SetImportLinkInterface(
const std::string& config, std::string const& suffix,
cmGeneratorExpression::PreprocessContext preprocessRule,
cmGeneratorTarget const* target, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
cmGeneratorTarget const* target, ImportPropertyMap& properties);
enum FreeTargetsReplace
{
@@ -178,7 +170,6 @@ protected:
void ResolveTargetsInGeneratorExpressions(
std::string& input, cmGeneratorTarget const* target,
std::vector<std::string>& missingTargets,
FreeTargetsReplace replace = NoReplaceFreeTargets);
virtual void GenerateRequiredCMakeVersion(std::ostream& os,
@@ -216,20 +207,20 @@ protected:
// The set of targets included in the export.
std::set<cmGeneratorTarget*> ExportedTargets;
std::vector<std::string> MissingTargets;
private:
void PopulateInterfaceProperty(const std::string&, const std::string&,
cmGeneratorTarget const* target,
cmGeneratorExpression::PreprocessContext,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
ImportPropertyMap& properties);
bool AddTargetNamespace(std::string& input, cmGeneratorTarget const* target,
cmLocalGenerator const* lg,
std::vector<std::string>& missingTargets);
cmLocalGenerator const* lg);
void ResolveTargetsInGeneratorExpression(
std::string& input, cmGeneratorTarget const* target,
cmLocalGenerator const* lg, std::vector<std::string>& missingTargets);
void ResolveTargetsInGeneratorExpression(std::string& input,
cmGeneratorTarget const* target,
cmLocalGenerator const* lg);
virtual void ReplaceInstallPrefix(std::string& input);