123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- #ifndef cmExportFileGenerator_h
- #define cmExportFileGenerator_h
- #include "cmConfigure.h"
- #include "cmGeneratorExpression.h"
- #include "cmVersion.h"
- #include "cmVersionConfig.h"
- #include <iosfwd>
- #include <map>
- #include <set>
- #include <string>
- #include <vector>
- class cmGeneratorTarget;
- #define STRINGIFY_HELPER(X) #X
- #define STRINGIFY(X) STRINGIFY_HELPER(X)
- #define DEVEL_CMAKE_VERSION(major, minor) \
- (CMake_VERSION_ENCODE(major, minor, 0) > \
- CMake_VERSION_ENCODE(CMake_VERSION_MAJOR, CMake_VERSION_MINOR, 0) \
- ? STRINGIFY(CMake_VERSION_MAJOR) "." STRINGIFY( \
- CMake_VERSION_MINOR) "." STRINGIFY(CMake_VERSION_PATCH) \
- : #major "." #minor ".0")
- class cmTargetExport;
- class cmExportFileGenerator
- {
- public:
- cmExportFileGenerator();
- virtual ~cmExportFileGenerator() {}
-
- void SetExportFile(const char* mainFile);
- const char* GetMainExportFileName() const;
-
- void SetNamespace(const std::string& ns) { this->Namespace = ns; }
- std::string GetNamespace() const { return this->Namespace; }
- void SetExportOld(bool exportOld) { this->ExportOld = exportOld; }
-
- void AddConfiguration(const std::string& config);
-
- bool GenerateImportFile();
- protected:
- typedef std::map<std::string, std::string> ImportPropertyMap;
-
-
- void GenerateImportConfig(std::ostream& os, const std::string& config,
- std::vector<std::string>& missingTargets);
-
- virtual void GeneratePolicyHeaderCode(std::ostream& os);
- virtual void GeneratePolicyFooterCode(std::ostream& os);
- virtual void GenerateImportHeaderCode(std::ostream& os,
- const std::string& config = "");
- virtual void GenerateImportFooterCode(std::ostream& os);
- void GenerateImportVersionCode(std::ostream& os);
- virtual void GenerateImportTargetCode(std::ostream& os,
- cmGeneratorTarget const* target);
- virtual void GenerateImportPropertyCode(std::ostream& os,
- const std::string& config,
- cmGeneratorTarget const* target,
- ImportPropertyMap const& properties);
- virtual void GenerateImportedFileChecksCode(
- std::ostream& os, cmGeneratorTarget* target,
- 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 GenerateExpectedTargetsCode(std::ostream& os,
- const std::string& expectedTargets);
-
-
- void SetImportDetailProperties(const std::string& config,
- std::string const& suffix,
- cmGeneratorTarget* target,
- ImportPropertyMap& properties,
- std::vector<std::string>& missingTargets);
- template <typename T>
- void SetImportLinkProperty(std::string const& suffix,
- cmGeneratorTarget* target,
- const std::string& propName,
- std::vector<T> const& entries,
- ImportPropertyMap& properties,
- std::vector<std::string>& missingTargets);
-
- virtual bool GenerateMainFile(std::ostream& os) = 0;
-
- virtual void GenerateImportTargetsConfig(
- std::ostream& os, const std::string& config, std::string const& suffix,
- std::vector<std::string>& missingTargets) = 0;
-
- virtual void HandleMissingTarget(std::string& link_libs,
- std::vector<std::string>& missingTargets,
- cmGeneratorTarget* depender,
- cmGeneratorTarget* dependee) = 0;
- void PopulateInterfaceProperty(const std::string&, cmGeneratorTarget* target,
- cmGeneratorExpression::PreprocessContext,
- ImportPropertyMap& properties,
- std::vector<std::string>& missingTargets);
- bool PopulateInterfaceLinkLibrariesProperty(
- cmGeneratorTarget* target, cmGeneratorExpression::PreprocessContext,
- ImportPropertyMap& properties, std::vector<std::string>& missingTargets);
- void PopulateInterfaceProperty(const std::string& propName,
- cmGeneratorTarget* target,
- ImportPropertyMap& properties);
- void PopulateCompatibleInterfaceProperties(cmGeneratorTarget* target,
- ImportPropertyMap& properties);
- virtual void GenerateInterfaceProperties(
- cmGeneratorTarget const* target, std::ostream& os,
- const ImportPropertyMap& properties);
- void PopulateIncludeDirectoriesInterface(
- cmTargetExport* target,
- cmGeneratorExpression::PreprocessContext preprocessRule,
- ImportPropertyMap& properties, std::vector<std::string>& missingTargets);
- void PopulateSourcesInterface(
- cmTargetExport* 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,
- std::vector<std::string>& missingTargets);
- enum FreeTargetsReplace
- {
- ReplaceFreeTargets,
- NoReplaceFreeTargets
- };
- void ResolveTargetsInGeneratorExpressions(
- std::string& input, cmGeneratorTarget* target,
- std::vector<std::string>& missingTargets,
- FreeTargetsReplace replace = NoReplaceFreeTargets);
- virtual void GenerateRequiredCMakeVersion(std::ostream& os,
- const char* versionString);
-
- std::string Namespace;
- bool ExportOld;
-
- std::vector<std::string> Configurations;
-
- std::string MainImportFile;
- std::string FileDir;
- std::string FileBase;
- std::string FileExt;
- bool AppendMode;
-
- std::set<cmGeneratorTarget*> ExportedTargets;
- private:
- void PopulateInterfaceProperty(const std::string&, const std::string&,
- cmGeneratorTarget* target,
- cmGeneratorExpression::PreprocessContext,
- ImportPropertyMap& properties,
- std::vector<std::string>& missingTargets);
- bool AddTargetNamespace(std::string& input, cmGeneratorTarget* target,
- std::vector<std::string>& missingTargets);
- void ResolveTargetsInGeneratorExpression(
- std::string& input, cmGeneratorTarget* target,
- std::vector<std::string>& missingTargets);
- virtual void ReplaceInstallPrefix(std::string& input);
- virtual std::string InstallNameDir(cmGeneratorTarget* target,
- const std::string& config) = 0;
- };
- #endif
|