From 0f876439e941c18f7fc264fbf02f5df9bc531f90 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 18 Nov 2013 15:11:10 +0100 Subject: cmGeneratorTarget: Make GetIncludeDirectories const. --- Source/cmGeneratorTarget.cxx | 4 ++-- Source/cmGeneratorTarget.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index b964f71..011fc6c 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -611,8 +611,8 @@ const char* cmGeneratorTarget::GetCreateRuleVariable() const } //---------------------------------------------------------------------------- -std::vector cmGeneratorTarget::GetIncludeDirectories( - const char *config) +std::vector +cmGeneratorTarget::GetIncludeDirectories(const char *config) const { return this->Target->GetIncludeDirectories(config); } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 177bc25..69d1bb2 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -70,7 +70,7 @@ public: const char* GetCreateRuleVariable() const; /** Get the include directories for this target. */ - std::vector GetIncludeDirectories(const char *config); + std::vector GetIncludeDirectories(const char *config) const; bool IsSystemIncludeDirectory(const char *dir, const char *config) const; -- cgit v0.12 From 50d152035da514005eaaa1d3e39e407676efd73c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 19 Nov 2013 11:05:47 +0100 Subject: cmTarget: Make custom command accessors API const. Add specific mutators instead of providing non-const refs. --- Source/cmGlobalGenerator.cxx | 2 +- Source/cmMakefile.cxx | 6 +++--- Source/cmNinjaNormalTargetGenerator.cxx | 2 +- Source/cmQtAutoGenerators.cxx | 2 +- Source/cmTarget.h | 12 +++++++++--- Source/cmVisualStudio10TargetGenerator.cxx | 6 +++--- Source/cmVisualStudio10TargetGenerator.h | 3 ++- 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 65a7118..a160336 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2407,7 +2407,7 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget( // Store the custom command in the target. cmCustomCommand cc(0, no_outputs, no_depends, *commandLines, 0, workingDirectory); - target.GetPostBuildCommands().push_back(cc); + target.AddPostBuildCommand(cc); target.SetProperty("EchoString", message); std::vector::iterator dit; for ( dit = depends.begin(); dit != depends.end(); ++ dit ) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ac8381c..4a2153d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -903,13 +903,13 @@ cmMakefile::AddCustomCommandToTarget(const char* target, switch(type) { case cmTarget::PRE_BUILD: - ti->second.GetPreBuildCommands().push_back(cc); + ti->second.AddPreBuildCommand(cc); break; case cmTarget::PRE_LINK: - ti->second.GetPreLinkCommands().push_back(cc); + ti->second.AddPreLinkCommand(cc); break; case cmTarget::POST_BUILD: - ti->second.GetPostBuildCommands().push_back(cc); + ti->second.AddPostBuildCommand(cc); break; } } diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 015654b..d8e9b34 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -534,7 +534,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() std::replace(linkLibraries.begin(), linkLibraries.end(), '\\', '/'); } - std::vector *cmdLists[3] = { + const std::vector *cmdLists[3] = { &this->GetTarget()->GetPreBuildCommands(), &this->GetTarget()->GetPreLinkCommands(), &this->GetTarget()->GetPostBuildCommands() diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 36cb368..35717ce 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -257,7 +257,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) workingDirectory.c_str()); cc.SetEscapeOldStyle(false); cc.SetEscapeAllowMakeVars(true); - target->GetPreBuildCommands().push_back(cc); + target->AddPreBuildCommand(cc); } else #endif diff --git a/Source/cmTarget.h b/Source/cmTarget.h index b516a0a..bafcb15 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -114,12 +114,18 @@ public: /** * Get the list of the custom commands for this target */ - std::vector &GetPreBuildCommands() + std::vector const &GetPreBuildCommands() const {return this->PreBuildCommands;} - std::vector &GetPreLinkCommands() + std::vector const &GetPreLinkCommands() const {return this->PreLinkCommands;} - std::vector &GetPostBuildCommands() + std::vector const &GetPostBuildCommands() const {return this->PostBuildCommands;} + void AddPreBuildCommand(cmCustomCommand const &cmd) + {this->PreBuildCommands.push_back(cmd);} + void AddPreLinkCommand(cmCustomCommand const &cmd) + {this->PreLinkCommands.push_back(cmd);} + void AddPostBuildCommand(cmCustomCommand const &cmd) + {this->PostBuildCommands.push_back(cmd);} /** * Get the list of the source files used by this target diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ace1eef..635d8cb 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1794,7 +1794,7 @@ cmVisualStudio10TargetGenerator::WriteEvents(std::string const& configName) void cmVisualStudio10TargetGenerator::WriteEvent( const char* name, - std::vector & commands, + std::vector const& commands, std::string const& configName) { if(commands.size() == 0) @@ -1807,10 +1807,10 @@ void cmVisualStudio10TargetGenerator::WriteEvent( std::string script; const char* pre = ""; std::string comment; - for(std::vector::iterator i = commands.begin(); + for(std::vector::const_iterator i = commands.begin(); i != commands.end(); ++i) { - cmCustomCommand& command = *i; + const cmCustomCommand& command = *i; comment += pre; comment += lg->ConstructComment(command); script += pre; diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 9a480a8..d1f3d19 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -87,7 +87,8 @@ private: void AddLibraries(cmComputeLinkInformation& cli, std::string& libstring); void WriteLibOptions(std::string const& config); void WriteEvents(std::string const& configName); - void WriteEvent(const char* name, std::vector & commands, + void WriteEvent(const char* name, + std::vector const& commands, std::string const& configName); void WriteGroupSources(const char* name, ToolSources const& sources, std::vector& ); -- cgit v0.12 From 04d398d3561453beb5e52db61810d98a832761ce Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 19 Nov 2013 11:11:15 +0100 Subject: cmTarget: Make GetTargetSourceFileFlags const. --- Source/cmTarget.cxx | 8 ++++---- Source/cmTarget.h | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c9905b6..26b1e76 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -91,8 +91,8 @@ public: } ~cmTargetInternals(); typedef cmTarget::SourceFileFlags SourceFileFlags; - std::map SourceFlagsMap; - bool SourceFileFlagsConstructed; + mutable std::map SourceFlagsMap; + mutable bool SourceFileFlagsConstructed; // The backtrace when the target was created. cmListFileBacktrace Backtrace; @@ -577,7 +577,7 @@ void cmTarget::ProcessSourceExpression(std::string const& expr) //---------------------------------------------------------------------------- struct cmTarget::SourceFileFlags -cmTarget::GetTargetSourceFileFlags(const cmSourceFile* sf) +cmTarget::GetTargetSourceFileFlags(const cmSourceFile* sf) const { struct SourceFileFlags flags; this->ConstructSourceFileFlags(); @@ -591,7 +591,7 @@ cmTarget::GetTargetSourceFileFlags(const cmSourceFile* sf) } //---------------------------------------------------------------------------- -void cmTarget::ConstructSourceFileFlags() +void cmTarget::ConstructSourceFileFlags() const { if(this->Internal->SourceFileFlagsConstructed) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index bafcb15..e67edd7 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -162,7 +162,8 @@ public: /** * Get the flags for a given source file as used in this target */ - struct SourceFileFlags GetTargetSourceFileFlags(const cmSourceFile* sf); + struct SourceFileFlags + GetTargetSourceFileFlags(const cmSourceFile* sf) const; /** * Add sources to the target. @@ -742,7 +743,7 @@ private: friend class cmTargetTraceDependencies; cmTargetInternalPointer Internal; - void ConstructSourceFileFlags(); + void ConstructSourceFileFlags() const; void ComputeVersionedName(std::string& vName, std::string const& prefix, std::string const& base, -- cgit v0.12 From 36e31cd1279cc441ba61bd38e85562fb2eafc449 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 19 Nov 2013 11:13:04 +0100 Subject: cmTarget: Make GetInterfaceLinkLibraries const. --- Source/cmTarget.cxx | 2 +- Source/cmTarget.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 26b1e76..b0caf16 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -811,7 +811,7 @@ void cmTarget::GetDirectLinkLibraries(const char *config, //---------------------------------------------------------------------------- void cmTarget::GetInterfaceLinkLibraries(const char *config, - std::vector &libs, cmTarget *head) + std::vector &libs, cmTarget *head) const { const char *prop = this->GetProperty("INTERFACE_LINK_LIBRARIES"); if (prop) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index e67edd7..aeb8703 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -186,7 +186,7 @@ public: cmTarget const* head) const; void GetInterfaceLinkLibraries(const char *config, std::vector &, - cmTarget *head); + cmTarget *head) const; /** Compute the link type to use for the given configuration. */ LinkLibraryType ComputeLinkType(const char* config) const; -- cgit v0.12 From 8841d738cc7be3f91e16d62e83c0cd7f2cb2f626 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 19 Nov 2013 11:32:30 +0100 Subject: cmMakefile: Make IsAlias const. --- Source/cmGlobalGenerator.cxx | 2 +- Source/cmGlobalGenerator.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a160336..2f16e9c 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1981,7 +1981,7 @@ void cmGlobalGenerator::AddAlias(const char *name, cmTarget *tgt) } //---------------------------------------------------------------------------- -bool cmGlobalGenerator::IsAlias(const char *name) +bool cmGlobalGenerator::IsAlias(const char *name) const { return this->AliasTargets.find(name) != this->AliasTargets.end(); } diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index ae139ed..15bc366 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -210,7 +210,7 @@ public: bool excludeAliases = false); void AddAlias(const char *name, cmTarget *tgt); - bool IsAlias(const char *name); + bool IsAlias(const char *name) const; /** Determine if a name resolves to a framework on disk or a built target that is a framework. */ -- cgit v0.12 From 37554acf43f1a94f22b3b9fb8838d685ffa07194 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 19 Nov 2013 11:47:36 +0100 Subject: cmMakefile: Make FindTarget const. --- Source/cmMakefile.cxx | 10 ++++------ Source/cmMakefile.h | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 4a2153d..6be1fdd 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3822,21 +3822,19 @@ const char* cmMakefile::GetFeature(const char* feature, const char* config) return 0; } -cmTarget* cmMakefile::FindTarget(const char* name, bool excludeAliases) +cmTarget* cmMakefile::FindTarget(const char* name, bool excludeAliases) const { if (!excludeAliases) { - std::map::iterator i + std::map::const_iterator i = this->AliasTargets.find(name); if (i != this->AliasTargets.end()) { return i->second; } } - cmTargets& tgts = this->GetTargets(); - - cmTargets::iterator i = tgts.find ( name ); - if ( i != tgts.end() ) + cmTargets::iterator i = this->Targets.find( name ); + if ( i != this->Targets.end() ) { return &i->second; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 76958ca..44aaa66 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -533,7 +533,7 @@ public: this->GeneratorTargets = targets; } - cmTarget* FindTarget(const char* name, bool excludeAliases = false); + cmTarget* FindTarget(const char* name, bool excludeAliases = false) const; /** Find a target to use in place of the given name. The target returned may be imported or built within the project. */ @@ -902,7 +902,7 @@ protected: std::string ProjectName; // project name // libraries, classes, and executables - cmTargets Targets; + mutable cmTargets Targets; std::map AliasTargets; cmGeneratorTargetsType GeneratorTargets; std::vector SourceFiles; -- cgit v0.12 From 1c2752169c3d34b80fb331b4edcc31a6001d2974 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 19 Nov 2013 11:48:19 +0100 Subject: cmGlobalGenerator: Make NameResolvesToFramework const. --- Source/cmGlobalGenerator.cxx | 16 +++++++++------- Source/cmGlobalGenerator.h | 4 ++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2f16e9c..7366c09 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1989,15 +1989,16 @@ bool cmGlobalGenerator::IsAlias(const char *name) const //---------------------------------------------------------------------------- cmTarget* cmGlobalGenerator::FindTarget(const char* project, const char* name, - bool excludeAliases) + bool excludeAliases) const { // if project specific if(project) { - std::vector* gens = &this->ProjectMap[project]; - for(unsigned int i = 0; i < gens->size(); ++i) + std::map >::const_iterator + gens = this->ProjectMap.find(project); + for(unsigned int i = 0; i < gens->second.size(); ++i) { - cmTarget* ret = (*gens)[i]->GetMakefile()->FindTarget(name, + cmTarget* ret = (gens->second)[i]->GetMakefile()->FindTarget(name, excludeAliases); if(ret) { @@ -2010,14 +2011,14 @@ cmGlobalGenerator::FindTarget(const char* project, const char* name, { if (!excludeAliases) { - std::map::iterator ai + std::map::const_iterator ai = this->AliasTargets.find(name); if (ai != this->AliasTargets.end()) { return ai->second; } } - std::map::iterator i = + std::map::const_iterator i = this->TotalTargets.find ( name ); if ( i != this->TotalTargets.end() ) { @@ -2033,7 +2034,8 @@ cmGlobalGenerator::FindTarget(const char* project, const char* name, } //---------------------------------------------------------------------------- -bool cmGlobalGenerator::NameResolvesToFramework(const std::string& libname) +bool +cmGlobalGenerator::NameResolvesToFramework(const std::string& libname) const { if(cmSystemTools::IsPathToFramework(libname.c_str())) { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 15bc366..eb720a8 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -207,14 +207,14 @@ public: ///! Find a target by name by searching the local generators. cmTarget* FindTarget(const char* project, const char* name, - bool excludeAliases = false); + bool excludeAliases = false) const; void AddAlias(const char *name, cmTarget *tgt); bool IsAlias(const char *name) const; /** Determine if a name resolves to a framework on disk or a built target that is a framework. */ - bool NameResolvesToFramework(const std::string& libname); + bool NameResolvesToFramework(const std::string& libname) const; /** If check to see if the target is linked to by any other target in the project */ -- cgit v0.12 From 0794c1360d43a61e96d11a62f493972e3ed52d8c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 19 Nov 2013 11:48:55 +0100 Subject: cmTarget: Make NameResolvesToFramework const. --- Source/cmTarget.cxx | 4 ++-- Source/cmTarget.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b0caf16..e063125 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -769,9 +769,9 @@ void cmTarget::ClearDependencyInformation( cmMakefile& mf, } //---------------------------------------------------------------------------- -bool cmTarget::NameResolvesToFramework(const std::string& libname) +bool cmTarget::NameResolvesToFramework(const std::string& libname) const { - return this->GetMakefile()->GetLocalGenerator()->GetGlobalGenerator()-> + return this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> NameResolvesToFramework(libname); } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index aeb8703..d78fe35 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -197,7 +197,7 @@ public: void ClearDependencyInformation(cmMakefile& mf, const char* target); // Check to see if a library is a framework and treat it different on Mac - bool NameResolvesToFramework(const std::string& libname); + bool NameResolvesToFramework(const std::string& libname) const; void AddLinkLibrary(cmMakefile& mf, const char *target, const char* lib, LinkLibraryType llt); -- cgit v0.12 From be9dfb6b2ecd5a94d17f1bf7a478bfb85710f2be Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 19 Nov 2013 11:49:42 +0100 Subject: cmTarget: Make GetExportMacro const. The std::string member is only used for memory management. --- Source/cmTarget.cxx | 2 +- Source/cmTarget.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e063125..f8cf079 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4037,7 +4037,7 @@ std::string cmTarget::GetFrameworkVersion() const } //---------------------------------------------------------------------------- -const char* cmTarget::GetExportMacro() +const char* cmTarget::GetExportMacro() const { // Define the symbol for targets that export symbols. if(this->GetType() == cmTarget::SHARED_LIBRARY || diff --git a/Source/cmTarget.h b/Source/cmTarget.h index d78fe35..cbd5f58 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -449,7 +449,7 @@ public: /** Get the macro to define when building sources in this target. If no macro should be defined null is returned. */ - const char* GetExportMacro(); + const char* GetExportMacro() const; void GetCompileDefinitions(std::vector &result, const char *config) const; @@ -678,7 +678,7 @@ private: bool HaveInstallRule; std::string InstallPath; std::string RuntimeInstallPath; - std::string ExportMacro; + mutable std::string ExportMacro; std::set Utilities; bool RecordDependencies; mutable cmPropertyMap Properties; -- cgit v0.12 From 15eeacefc5aa91a9767a360dbea4fd8a44b8eca6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 19 Nov 2013 11:50:23 +0100 Subject: cmTarget: Trivially make more API const. --- Source/cmTarget.cxx | 22 +++++++++++----------- Source/cmTarget.h | 29 +++++++++++++++-------------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f8cf079..cf68e38 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -438,7 +438,7 @@ bool cmTarget::IsExecutableWithExports() const } //---------------------------------------------------------------------------- -bool cmTarget::IsLinkable() +bool cmTarget::IsLinkable() const { return (this->GetType() == cmTarget::STATIC_LIBRARY || this->GetType() == cmTarget::SHARED_LIBRARY || @@ -834,7 +834,7 @@ void cmTarget::GetInterfaceLinkLibraries(const char *config, //---------------------------------------------------------------------------- std::string cmTarget::GetDebugGeneratorExpressions(const std::string &value, - cmTarget::LinkLibraryType llt) + cmTarget::LinkLibraryType llt) const { if (llt == GENERAL) { @@ -2276,7 +2276,7 @@ static void cmTargetCheckINTERFACE_LINK_LIBRARIES(const char* value, } //---------------------------------------------------------------------------- -void cmTarget::CheckProperty(const char* prop, cmMakefile* context) +void cmTarget::CheckProperty(const char* prop, cmMakefile* context) const { // Certain properties need checking. if(strncmp(prop, "LINK_INTERFACE_LIBRARIES", 24) == 0) @@ -2382,7 +2382,7 @@ std::string cmTarget::GetDirectory(const char* config, bool implib) const } //---------------------------------------------------------------------------- -std::string cmTarget::GetPDBDirectory(const char* config) +std::string cmTarget::GetPDBDirectory(const char* config) const { if(OutputInfo const* info = this->GetOutputInfo(config)) { @@ -2453,7 +2453,7 @@ const char* cmTarget::NormalGetLocation(const char* config) const } //---------------------------------------------------------------------------- -void cmTarget::GetTargetVersion(int& major, int& minor) +void cmTarget::GetTargetVersion(int& major, int& minor) const { int patch; this->GetTargetVersion(false, major, minor, patch); @@ -2461,7 +2461,7 @@ void cmTarget::GetTargetVersion(int& major, int& minor) //---------------------------------------------------------------------------- void cmTarget::GetTargetVersion(bool soversion, - int& major, int& minor, int& patch) + int& major, int& minor, int& patch) const { // Set the default values. major = 0; @@ -2489,7 +2489,7 @@ void cmTarget::GetTargetVersion(bool soversion, } //---------------------------------------------------------------------------- -const char* cmTarget::GetFeature(const char* feature, const char* config) +const char* cmTarget::GetFeature(const char* feature, const char* config) const { if(config && *config) { @@ -3145,7 +3145,7 @@ bool cmTarget::HasMacOSXRpath(const char* config) const } //---------------------------------------------------------------------------- -bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config) +bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config) const { if(this->IsImported() && this->GetType() == cmTarget::SHARED_LIBRARY) { @@ -3597,14 +3597,14 @@ void cmTarget::GetExecutableNames(std::string& name, } //---------------------------------------------------------------------------- -bool cmTarget::HasImplibGNUtoMS() +bool cmTarget::HasImplibGNUtoMS() const { return this->HasImportLibrary() && this->GetPropertyAsBool("GNUtoMS"); } //---------------------------------------------------------------------------- bool cmTarget::GetImplibGNUtoMS(std::string const& gnuName, - std::string& out, const char* newExt) + std::string& out, const char* newExt) const { if(this->HasImplibGNUtoMS() && gnuName.size() > 6 && gnuName.substr(gnuName.size()-6) == ".dll.a") @@ -3976,7 +3976,7 @@ bool cmTarget::ComputePDBOutputDir(const char* config, std::string& out) const } //---------------------------------------------------------------------------- -bool cmTarget::UsesDefaultOutputDir(const char* config, bool implib) +bool cmTarget::UsesDefaultOutputDir(const char* config, bool implib) const { std::string dir; return this->ComputeOutputDir(config, implib, dir); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index cbd5f58..35ec680 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -219,14 +219,14 @@ public: * Set the path where this target should be installed. This is relative to * INSTALL_PREFIX */ - std::string GetInstallPath() {return this->InstallPath;} + std::string GetInstallPath() const {return this->InstallPath;} void SetInstallPath(const char *name) {this->InstallPath = name;} /** * Set the path where this target (if it has a runtime part) should be * installed. This is relative to INSTALL_PREFIX */ - std::string GetRuntimeInstallPath() {return this->RuntimeInstallPath;} + std::string GetRuntimeInstallPath() const {return this->RuntimeInstallPath;} void SetRuntimeInstallPath(const char *name) { this->RuntimeInstallPath = name; } @@ -253,9 +253,9 @@ public: const char *GetProperty(const char *prop) const; const char *GetProperty(const char *prop, cmProperty::ScopeType scope) const; bool GetPropertyAsBool(const char *prop) const; - void CheckProperty(const char* prop, cmMakefile* context); + void CheckProperty(const char* prop, cmMakefile* context) const; - const char* GetFeature(const char* feature, const char* config); + const char* GetFeature(const char* feature, const char* config) const; bool IsImported() const {return this->IsImportedTarget;} @@ -337,7 +337,7 @@ public: If the configuration name is given then the generator will add its subdirectory for that configuration. Otherwise just the canonical pdb output directory is given. */ - std::string GetPDBDirectory(const char* config = 0); + std::string GetPDBDirectory(const char* config = 0) const; /** Get the location of the target in the build tree for the given configuration. This location is suitable for use as the LOCATION @@ -347,12 +347,13 @@ public: /** Get the target major and minor version numbers interpreted from the VERSION property. Version 0 is returned if the property is not set or cannot be parsed. */ - void GetTargetVersion(int& major, int& minor); + void GetTargetVersion(int& major, int& minor) const; /** Get the target major, minor, and patch version numbers interpreted from the VERSION or SOVERSION property. Version 0 is returned if the property is not set or cannot be parsed. */ - void GetTargetVersion(bool soversion, int& major, int& minor, int& patch); + void + GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const; /** * Make sure the full path to all source files is known. @@ -384,7 +385,7 @@ public: /** Test for special case of a third-party shared library that has no soname at all. */ - bool IsImportedSharedLibWithoutSOName(const char* config); + bool IsImportedSharedLibWithoutSOName(const char* config) const; /** Get the full path to the target according to the settings in its makefile and the configuration type. */ @@ -406,12 +407,12 @@ public: std::string& pdbName, const char* config) const; /** Does this target have a GNU implib to convert to MS format? */ - bool HasImplibGNUtoMS(); + bool HasImplibGNUtoMS() const; /** Convert the given GNU import library name (.dll.a) to a name with a new extension (.lib or ${CMAKE_IMPORT_LIBRARY_SUFFIX}). */ bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out, - const char* newExt = 0); + const char* newExt = 0) const; /** * Compute whether this target must be relinked before installing. @@ -466,10 +467,10 @@ public: bool IsExecutableWithExports() const; /** Return whether this target may be used to link another target. */ - bool IsLinkable(); + bool IsLinkable() const; /** Return whether or not the target is for a DLL platform. */ - bool IsDLLPlatform() { return this->DLLPlatform; } + bool IsDLLPlatform() const { return this->DLLPlatform; } /** Return whether or not the target has a DLL import library. */ bool HasImportLibrary() const; @@ -500,7 +501,7 @@ public: /** Return whether this target uses the default value for its output directory. */ - bool UsesDefaultOutputDir(const char* config, bool implib); + bool UsesDefaultOutputDir(const char* config, bool implib) const; /** @return the mac content directory for this target. */ std::string GetMacContentDirectory(const char* config, @@ -553,7 +554,7 @@ public: const char *config) const; std::string GetDebugGeneratorExpressions(const std::string &value, - cmTarget::LinkLibraryType llt); + cmTarget::LinkLibraryType llt) const; void AddSystemIncludeDirectories(const std::set &incs); void AddSystemIncludeDirectories(const std::vector &incs); -- cgit v0.12