From c62cd3e2aeb9ed7e3021bd9e5863294fd0441790 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 10 Dec 2013 15:45:27 +0100 Subject: [PATCH] Constify autogen handling. --- Source/cmGlobalGenerator.h | 3 ++- Source/cmQtAutoGenerators.cxx | 22 ++++++++++++---------- Source/cmQtAutoGenerators.h | 8 ++++---- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index b7bc47536..f60d24d52 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -334,7 +334,8 @@ protected: virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS(); bool CheckTargets(); - typedef std::vector > AutogensType; + typedef std::vector > AutogensType; void CreateQtAutoGeneratorsTargets(AutogensType& autogens); std::string SelectMakeProgram(const char* makeProgram, diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 1988c5d95..2b4bb8a37 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -138,14 +138,14 @@ cmQtAutoGenerators::cmQtAutoGenerators() } } -static std::string getAutogenTargetName(cmTarget *target) +static std::string getAutogenTargetName(cmTarget const* target) { std::string autogenTargetName = target->GetName(); autogenTargetName += "_automoc"; return autogenTargetName; } -static std::string getAutogenTargetDir(cmTarget *target) +static std::string getAutogenTargetDir(cmTarget const* target) { cmMakefile* makefile = target->GetMakefile(); std::string targetDir = makefile->GetCurrentOutputDirectory(); @@ -296,7 +296,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) return true; } -static void GetCompileDefinitionsAndDirectories(cmTarget *target, +static void GetCompileDefinitionsAndDirectories(cmTarget const* target, const char * config, std::string &incs, std::string &defs) @@ -304,10 +304,12 @@ static void GetCompileDefinitionsAndDirectories(cmTarget *target, cmMakefile* makefile = target->GetMakefile(); cmLocalGenerator* localGen = makefile->GetLocalGenerator(); std::vector includeDirs; - cmGeneratorTarget gtgt(target); + cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator() + ->GetGlobalGenerator() + ->GetGeneratorTarget(target); // Get the include dirs for this target, without stripping the implicit // include dirs off, see http://public.kitware.com/Bug/view.php?id=13667 - localGen->GetIncludeDirectories(includeDirs, >gt, "CXX", config, false); + localGen->GetIncludeDirectories(includeDirs, gtgt, "CXX", config, false); const char* sep = ""; incs = ""; for(std::vector::const_iterator incDirIt = includeDirs.begin(); @@ -333,7 +335,7 @@ static void GetCompileDefinitionsAndDirectories(cmTarget *target, } } -void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target) +void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) { cmMakefile* makefile = target->GetMakefile(); @@ -436,7 +438,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target) } } -void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget* target, +void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, const std::string &autogenTargetName, std::map &configIncludes, std::map &configDefines) @@ -615,7 +617,7 @@ void cmQtAutoGenerators::MergeUicOptions(std::vector &opts, opts.insert(opts.end(), extraOpts.begin(), extraOpts.end()); } -static void GetUicOpts(cmTarget *target, const char * config, +static void GetUicOpts(cmTarget const* target, const char * config, std::string &optString) { std::vector opts; @@ -632,7 +634,7 @@ static void GetUicOpts(cmTarget *target, const char * config, } } -void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget* target, +void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, std::map &configUicOptions) { cmMakefile *makefile = target->GetMakefile(); @@ -837,7 +839,7 @@ void cmQtAutoGenerators::InitializeAutoRccTarget(cmTarget* target) } } -void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget* target) +void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) { std::string _rcc_files; const char* sepRccFiles = ""; diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index 0888ea4ad..80123d88c 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -24,17 +24,17 @@ public: bool Run(const char* targetDirectory, const char *config); bool InitializeAutogenTarget(cmTarget* target); - void SetupAutoGenerateTarget(cmTarget* target); + void SetupAutoGenerateTarget(cmTarget const* target); private: - void SetupAutoMocTarget(cmTarget* target, + void SetupAutoMocTarget(cmTarget const* target, const std::string &autogenTargetName, std::map &configIncludes, std::map &configDefines); - void SetupAutoUicTarget(cmTarget* target, + void SetupAutoUicTarget(cmTarget const* target, std::map &configUicOptions); void InitializeAutoRccTarget(cmTarget* target); - void SetupAutoRccTarget(cmTarget* target); + void SetupAutoRccTarget(cmTarget const* target); cmGlobalGenerator* CreateGlobalGenerator(cmake* cm, const char* targetDirectory);