diff options
Diffstat (limited to 'Source/cmGlobalGenerator.h')
-rw-r--r-- | Source/cmGlobalGenerator.h | 131 |
1 files changed, 67 insertions, 64 deletions
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 753eebf..49a418d 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -51,11 +51,11 @@ public: virtual cmLocalGenerator *CreateLocalGenerator(); ///! Get the name for this generator - virtual const char *GetName() const { return "Generic"; }; + virtual std::string GetName() const { return "Generic"; }; /** Check whether the given name matches the current generator. */ - virtual bool MatchesGeneratorName(const char* name) const - { return strcmp(this->GetName(), name) == 0; } + virtual bool MatchesGeneratorName(const std::string& name) const + { return this->GetName() == name; } /** Set the generator-specific toolset name. Returns true if toolset is supported and false otherwise. */ @@ -77,8 +77,8 @@ public: /** * Set/Get and Clear the enabled languages. */ - void SetLanguageEnabled(const char*, cmMakefile* mf); - bool GetLanguageEnabled(const char*) const; + void SetLanguageEnabled(const std::string&, cmMakefile* mf); + bool GetLanguageEnabled(const std::string&) const; void ClearEnabledLanguages(); void GetEnabledLanguages(std::vector<std::string>& lang) const; /** @@ -105,8 +105,9 @@ public: * Try running cmake and building a file. This is used for dynamically * loaded commands, not as part of the usual build process. */ - virtual int TryCompile(const char *srcdir, const char *bindir, - const char *projectName, const char *targetName, + virtual int TryCompile(const std::string& srcdir, const std::string& bindir, + const std::string& projectName, + const std::string& targetName, bool fast, std::string *output, cmMakefile* mf); @@ -116,10 +117,10 @@ public: * empty then all is assumed. clean indicates if a "make clean" should be * done first. */ - int Build(const char *srcdir, const char *bindir, - const char *projectName, const char *targetName, + int Build(const std::string& srcdir, const std::string& bindir, + const std::string& projectName, const std::string& targetName, std::string *output, - const char *makeProgram, const char *config, + const std::string& makeProgram, const std::string& config, bool clean, bool fast, double timeout, cmSystemTools::OutputOption outputflag=cmSystemTools::OUTPUT_NONE, @@ -128,16 +129,16 @@ public: virtual void GenerateBuildCommand( std::vector<std::string>& makeCommand, - const char* makeProgram, - const char *projectName, const char *projectDir, - const char *targetName, const char* config, bool fast, + const std::string& makeProgram, + const std::string& projectName, const std::string& projectDir, + const std::string& targetName, const std::string& config, bool fast, std::vector<std::string> const& makeOptions = std::vector<std::string>() ); /** Generate a "cmake --build" call for a given target and config. */ - std::string GenerateCMakeBuildCommand(const char* target, - const char* config, - const char* native, + std::string GenerateCMakeBuildCommand(const std::string& target, + const std::string& config, + const std::string& native, bool ignoreErrors); ///! Set the CMake instance @@ -162,17 +163,17 @@ public: void SetExternalMakefileProjectGenerator( cmExternalMakefileProjectGenerator *extraGenerator); - const char* GetExtraGeneratorName() const; + std::string GetExtraGeneratorName() const; void AddInstallComponent(const char* component); - const std::set<cmStdString>* GetInstallComponents() const + const std::set<std::string>* GetInstallComponents() const { return &this->InstallComponents; } cmExportSetMap& GetExportSets() {return this->ExportSets;} /** Add a file to the manifest of generated targets for a configuration. */ - void AddToManifest(const char* config, std::string const& f); + void AddToManifest(const std::string& config, std::string const& f); void EnableInstallTarget(); @@ -182,13 +183,13 @@ public: bool GetToolSupportsColor() const { return this->ToolSupportsColor; } ///! return the language for the given extension - const char* GetLanguageFromExtension(const char* ext) const; + std::string GetLanguageFromExtension(const char* ext) const; ///! is an extension to be ignored bool IgnoreFile(const char* ext) const; ///! What is the preference for linkers and this language (None or Prefered) - int GetLinkerPreference(const char* lang) const; + int GetLinkerPreference(const std::string& lang) const; ///! What is the object file extension for a given source file? - const char* GetLanguageOutputExtension(cmSourceFile const&) const; + std::string GetLanguageOutputExtension(cmSourceFile const&) const; ///! What is the configurations directory variable called? virtual const char* GetCMakeCFGIntDir() const { return "."; } @@ -210,11 +211,11 @@ public: virtual void FindMakeProgram(cmMakefile*); ///! Find a target by name by searching the local generators. - cmTarget* FindTarget(const char* project, const char* name, + cmTarget* FindTarget(const std::string& name, bool excludeAliases = false) const; - void AddAlias(const char *name, cmTarget *tgt); - bool IsAlias(const char *name) const; + void AddAlias(const std::string& name, cmTarget *tgt); + bool IsAlias(const std::string& name) const; /** Determine if a name resolves to a framework on disk or a built target that is a framework. */ @@ -222,16 +223,16 @@ public: /** If check to see if the target is linked to by any other target in the project */ - bool IsDependedOn(const char* project, cmTarget const* target); + bool IsDependedOn(const std::string& project, cmTarget const* target); ///! Find a local generator by its startdirectory - cmLocalGenerator* FindLocalGenerator(const char* start_dir) const; + cmLocalGenerator* FindLocalGenerator(const std::string& start_dir) const; /** Append the subdirectory for the given configuration. If anything is appended the given prefix and suffix will be appended around it, which is useful for leading or trailing slashes. */ - virtual void AppendDirectoryForConfig(const char* prefix, - const char* config, - const char* suffix, + virtual void AppendDirectoryForConfig(const std::string& prefix, + const std::string& config, + const std::string& suffix, std::string& dir); /** Get the manifest of all targets that will be built for each @@ -243,7 +244,7 @@ public: from disk at most once and cached. During the generation step the content will include the target files to be built even if they do not yet exist. */ - std::set<cmStdString> const& GetDirectoryContent(std::string const& dir, + std::set<std::string> const& GetDirectoryContent(std::string const& dir, bool needDisk = true); void AddTarget(cmTarget* t); @@ -275,7 +276,7 @@ public: /** Get per-target generator information. */ cmGeneratorTarget* GetGeneratorTarget(cmTarget const*) const; - const std::map<cmStdString, std::vector<cmLocalGenerator*> >& GetProjectMap() + const std::map<std::string, std::vector<cmLocalGenerator*> >& GetProjectMap() const {return this->ProjectMap;} // track files replaced during a Generate @@ -286,12 +287,12 @@ public: std::string const& content); /** Return whether the given binary directory is unused. */ - bool BinaryDirectoryIsNew(const char* dir) + bool BinaryDirectoryIsNew(const std::string& dir) { return this->BinaryDirectories.insert(dir).second; } /** Supported systems creates a GUID for the given name */ - virtual void CreateGUID(const char*) {} + virtual void CreateGUID(const std::string&) {} /** Return true if the generated build tree may contain multiple builds. i.e. "Can I build Debug and Release in the same tree?" */ @@ -322,6 +323,8 @@ public: GetExportedTargetsFile(const std::string &filename) const; void AddCMP0042WarnTarget(const std::string& target); + virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const; + protected: typedef std::vector<cmLocalGenerator*> GeneratorVector; // for a project collect all its targets by following depend @@ -332,21 +335,20 @@ protected: bool IsRootOnlyTarget(cmTarget* target) const; void AddTargetDepends(cmTarget const* target, TargetDependSet& projectTargets); - void SetLanguageEnabledFlag(const char* l, cmMakefile* mf); - void SetLanguageEnabledMaps(const char* l, cmMakefile* mf); - void FillExtensionToLanguageMap(const char* l, cmMakefile* mf); + void SetLanguageEnabledFlag(const std::string& l, cmMakefile* mf); + void SetLanguageEnabledMaps(const std::string& l, cmMakefile* mf); + void FillExtensionToLanguageMap(const std::string& l, cmMakefile* mf); virtual bool ComputeTargetDepends(); virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const; - bool CheckTargets(); typedef std::vector<std::pair<cmQtAutoGenerators, cmTarget const*> > AutogensType; void CreateQtAutoGeneratorsTargets(AutogensType& autogens); - std::string SelectMakeProgram(const char* makeProgram, - std::string makeDefault = "") const; + std::string SelectMakeProgram(const std::string& makeProgram, + const std::string& makeDefault = "") const; // Fill the ProjectMap, this must be called after LocalGenerators // has been populated. @@ -356,7 +358,7 @@ protected: bool IsExcluded(cmLocalGenerator* root, cmTarget const& target) const; void FillLocalGeneratorToTargetMap(); void CreateDefaultGlobalTargets(cmTargets* targets); - cmTarget CreateGlobalTarget(const char* name, const char* message, + cmTarget CreateGlobalTarget(const std::string& name, const char* message, const cmCustomCommandLines* commandLines, std::vector<std::string> depends, const char* workingDir); @@ -364,18 +366,18 @@ protected: bool UseLinkScript; bool ForceUnixPaths; bool ToolSupportsColor; - cmStdString FindMakeProgramFile; - cmStdString ConfiguredFilesPath; + std::string FindMakeProgramFile; + std::string ConfiguredFilesPath; cmake *CMakeInstance; std::vector<cmLocalGenerator *> LocalGenerators; cmLocalGenerator* CurrentLocalGenerator; // map from project name to vector of local generators in that project - std::map<cmStdString, std::vector<cmLocalGenerator*> > ProjectMap; + std::map<std::string, std::vector<cmLocalGenerator*> > ProjectMap; std::map<cmLocalGenerator*, std::set<cmTarget const*> > LocalGeneratorToTargetMap; // Set of named installation components requested by the project. - std::set<cmStdString> InstallComponents; + std::set<std::string> InstallComponents; bool InstallTargetEnabled; // Sets of named target exports cmExportSetMap ExportSets; @@ -387,9 +389,9 @@ protected: cmTargetManifest TargetManifest; // All targets in the entire project. - std::map<cmStdString,cmTarget *> TotalTargets; - std::map<cmStdString,cmTarget *> AliasTargets; - std::map<cmStdString,cmTarget *> ImportedTargets; + std::map<std::string,cmTarget *> TotalTargets; + std::map<std::string,cmTarget *> AliasTargets; + std::map<std::string,cmTarget *> ImportedTargets; std::vector<cmGeneratorExpressionEvaluationFile*> EvaluationFiles; virtual const char* GetPredefinedTargetsFolder(); @@ -401,18 +403,18 @@ private: float FirstTimeProgress; // If you add a new map here, make sure it is copied // in EnableLanguagesFromGenerator - std::map<cmStdString, bool> IgnoreExtensions; - std::map<cmStdString, bool> LanguageEnabled; - std::set<cmStdString> LanguagesReady; // Ready for try_compile - std::map<cmStdString, cmStdString> OutputExtensions; - std::map<cmStdString, cmStdString> LanguageToOutputExtension; - std::map<cmStdString, cmStdString> ExtensionToLanguage; - std::map<cmStdString, int> LanguageToLinkerPreference; - std::map<cmStdString, cmStdString> LanguageToOriginalSharedLibFlags; + std::map<std::string, bool> IgnoreExtensions; + std::map<std::string, bool> LanguageEnabled; + std::set<std::string> LanguagesReady; // Ready for try_compile + std::map<std::string, std::string> OutputExtensions; + std::map<std::string, std::string> LanguageToOutputExtension; + std::map<std::string, std::string> ExtensionToLanguage; + std::map<std::string, int> LanguageToLinkerPreference; + std::map<std::string, std::string> LanguageToOriginalSharedLibFlags; // Record hashes for rules and outputs. struct RuleHash { char Data[32]; }; - std::map<cmStdString, RuleHash> RuleHashes; + std::map<std::string, RuleHash> RuleHashes; void CheckRuleHashes(); void CheckRuleHashes(std::string const& pfile, std::string const& home); void WriteRuleHashes(std::string const& pfile); @@ -421,9 +423,10 @@ private: void WriteSummary(cmTarget* target); void FinalizeTargetCompileInfo(); - virtual void PrintCompilerAdvice(std::ostream& os, std::string lang, + virtual void PrintCompilerAdvice(std::ostream& os, std::string const& lang, const char* envVar) const; - void CheckCompilerIdCompatibility(cmMakefile* mf, std::string lang) const; + void CheckCompilerIdCompatibility(cmMakefile* mf, + std::string const& lang) const; cmExternalMakefileProjectGenerator* ExtraGenerator; @@ -440,25 +443,25 @@ private: void CreateGeneratorTargets(cmMakefile* mf); void CreateGeneratorTargets(); void ComputeGeneratorTargetObjects(); - virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; + void ComputeTargetObjects(cmGeneratorTarget* gt) const; void ClearGeneratorMembers(); virtual const char* GetBuildIgnoreErrorsFlag() const { return 0; } // Cache directory content and target files to be built. - struct DirectoryContent: public std::set<cmStdString> + struct DirectoryContent: public std::set<std::string> { - typedef std::set<cmStdString> derived; + typedef std::set<std::string> derived; bool LoadedFromDisk; DirectoryContent(): LoadedFromDisk(false) {} DirectoryContent(DirectoryContent const& dc): derived(dc), LoadedFromDisk(dc.LoadedFromDisk) {} }; - std::map<cmStdString, DirectoryContent> DirectoryContentMap; + std::map<std::string, DirectoryContent> DirectoryContentMap; // Set of binary directories on disk. - std::set<cmStdString> BinaryDirectories; + std::set<std::string> BinaryDirectories; // track targets to issue CMP0042 warning for. std::set<std::string> CMP0042WarnTargets; |