Refactor export file generator inteface

Replace cmTargetExport with const cmGeneratorTarget to allow recursive
processing of exported targets and their link dependencies.
This commit is contained in:
Eugene Shalygin
2021-07-20 21:41:36 +02:00
parent 55e4753bbb
commit e8e19ed8f2
8 changed files with 61 additions and 62 deletions

View File

@@ -27,8 +27,6 @@ class cmGeneratorTarget;
CMake_VERSION_MINOR) "." STRINGIFY(CMake_VERSION_PATCH) \
: #major "." #minor ".0")
class cmTargetExport;
/** \class cmExportFileGenerator
* \brief Generate a file exporting targets from a build or install tree.
*
@@ -108,7 +106,7 @@ protected:
};
template <typename T>
void SetImportLinkProperty(std::string const& suffix,
cmGeneratorTarget* target,
cmGeneratorTarget const* target,
const std::string& propName,
std::vector<T> const& entries,
ImportPropertyMap& properties,
@@ -127,44 +125,45 @@ protected:
* export set. */
virtual void HandleMissingTarget(std::string& link_libs,
std::vector<std::string>& missingTargets,
cmGeneratorTarget* depender,
cmGeneratorTarget const* depender,
cmGeneratorTarget* dependee) = 0;
void PopulateInterfaceProperty(const std::string&, cmGeneratorTarget* target,
void PopulateInterfaceProperty(const std::string&,
cmGeneratorTarget const* target,
cmGeneratorExpression::PreprocessContext,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
bool PopulateInterfaceLinkLibrariesProperty(
cmGeneratorTarget* target, cmGeneratorExpression::PreprocessContext,
cmGeneratorTarget const* target, cmGeneratorExpression::PreprocessContext,
ImportPropertyMap& properties, std::vector<std::string>& missingTargets);
void PopulateInterfaceProperty(const std::string& propName,
cmGeneratorTarget* target,
cmGeneratorTarget const* target,
ImportPropertyMap& properties);
void PopulateCompatibleInterfaceProperties(cmGeneratorTarget* target,
void PopulateCompatibleInterfaceProperties(cmGeneratorTarget const* target,
ImportPropertyMap& properties);
virtual void GenerateInterfaceProperties(
cmGeneratorTarget const* target, std::ostream& os,
const ImportPropertyMap& properties);
void PopulateIncludeDirectoriesInterface(
cmTargetExport* target,
cmGeneratorTarget const* target,
cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap& properties, std::vector<std::string>& missingTargets);
void PopulateSourcesInterface(
cmTargetExport* target,
cmGeneratorTarget const* target,
cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap& properties, std::vector<std::string>& missingTargets);
void PopulateLinkDirectoriesInterface(
cmTargetExport* target,
cmGeneratorTarget const* target,
cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap& properties, std::vector<std::string>& missingTargets);
void PopulateLinkDependsInterface(
cmTargetExport* target,
cmGeneratorTarget const* target,
cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap& properties, std::vector<std::string>& missingTargets);
void SetImportLinkInterface(
const std::string& config, std::string const& suffix,
cmGeneratorExpression::PreprocessContext preprocessRule,
cmGeneratorTarget* target, ImportPropertyMap& properties,
cmGeneratorTarget const* target, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
enum FreeTargetsReplace
@@ -174,14 +173,14 @@ protected:
};
void ResolveTargetsInGeneratorExpressions(
std::string& input, cmGeneratorTarget* target,
std::string& input, cmGeneratorTarget const* target,
std::vector<std::string>& missingTargets,
FreeTargetsReplace replace = NoReplaceFreeTargets);
virtual void GenerateRequiredCMakeVersion(std::ostream& os,
const char* versionString);
bool PopulateExportProperties(cmGeneratorTarget* gte,
bool PopulateExportProperties(cmGeneratorTarget const* gte,
ImportPropertyMap& properties,
std::string& errorMessage);
@@ -205,20 +204,20 @@ protected:
private:
void PopulateInterfaceProperty(const std::string&, const std::string&,
cmGeneratorTarget* target,
cmGeneratorTarget const* target,
cmGeneratorExpression::PreprocessContext,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
bool AddTargetNamespace(std::string& input, cmGeneratorTarget* target,
bool AddTargetNamespace(std::string& input, cmGeneratorTarget const* target,
std::vector<std::string>& missingTargets);
void ResolveTargetsInGeneratorExpression(
std::string& input, cmGeneratorTarget* target,
std::string& input, cmGeneratorTarget const* target,
std::vector<std::string>& missingTargets);
virtual void ReplaceInstallPrefix(std::string& input);
virtual std::string InstallNameDir(cmGeneratorTarget* target,
virtual std::string InstallNameDir(cmGeneratorTarget const* target,
const std::string& config) = 0;
};