diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 3c818ff5f..50e2cd965 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1549,6 +1549,7 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes, ti != targets.end(); ++ti) { cmTarget* t = &ti->second; + t->Compute(); cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg); this->GeneratorTargets[t] = gt; generatorTargets[t] = gt; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index d5a558553..51dcab06b 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -254,6 +254,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false, no_working_directory, no_depends, noCommandLines); + tgt->Compute(); cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg); mf->AddGeneratorTarget(tgt, gt); diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 2f9d79a97..b69fc65a5 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -90,6 +90,7 @@ bool cmGlobalVisualStudioGenerator::Compute() AddUtilityCommand("ALL_BUILD", true, no_working_dir, no_depends, no_commands, false, "Build all projects"); + allBuild->Compute(); cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]); allBuild->GetMakefile()->AddGeneratorTarget(allBuild, gt); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 500682825..39933cb6d 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -463,6 +463,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, cmTarget* allbuild = mf->AddUtilityCommand("ALL_BUILD", true, no_depends, no_working_directory, "echo", "Build all projects"); + allbuild->Compute(); cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root); mf->AddGeneratorTarget(allbuild, allBuildGt); @@ -497,6 +498,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, true, no_depends, no_working_directory, "make", "-f", file.c_str()); + check->Compute(); cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root); mf->AddGeneratorTarget(check, checkGt); } diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index f1ba2f477..ce806ba76 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -475,6 +475,8 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg, /*byproducts=*/rcc_output, depends, commandLines, false, autogenComment.c_str()); + autogenTarget->Compute(); + cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg); makefile->AddGeneratorTarget(autogenTarget, gt); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 7b258194a..1eb8e6a18 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -168,7 +168,9 @@ public: const cmsys::auto_ptr ge; cmLinkImplItem const& LinkImplItem; }; - std::vector IncludeDirectoriesEntries; + std::vector IncludeDirectoriesEntries; + std::vector IncludeDirectoriesBacktraces; + std::vector IncludeDirectoriesItems; std::vector CompileOptionsEntries; std::vector CompileFeaturesEntries; std::vector CompileDefinitionsEntries; @@ -366,13 +368,13 @@ void cmTarget::SetMakefile(cmMakefile* mf) const cmBacktraceRange parentIncludesBts = this->Makefile->GetIncludeDirectoriesBacktraces(); - cmBacktraceRange::const_iterator btIt = parentIncludesBts.begin(); - for (cmStringRange::const_iterator it - = parentIncludes.begin(); - it != parentIncludes.end(); ++it, ++btIt) - { - this->InsertInclude(*it, *btIt); - } + this->Internal->IncludeDirectoriesEntries.insert( + this->Internal->IncludeDirectoriesEntries.end(), + parentIncludes.begin(), parentIncludes.end()); + this->Internal->IncludeDirectoriesBacktraces.insert( + this->Internal->IncludeDirectoriesBacktraces.end(), + parentIncludesBts.begin(), parentIncludesBts.end()); + const std::set parentSystemIncludes = this->Makefile->GetSystemIncludeDirectories(); @@ -384,7 +386,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) const cmBacktraceRange parentOptionsBts = this->Makefile->GetCompileOptionsBacktraces(); - btIt = parentOptionsBts.begin(); + cmBacktraceRange::const_iterator btIt = parentOptionsBts.begin(); for (cmStringRange::const_iterator it = parentOptions.begin(); it != parentOptions.end(); ++it, ++btIt) @@ -438,6 +440,29 @@ void cmTarget::SetMakefile(cmMakefile* mf) } } +void CreatePropertyGeneratorExpressions( + std::vector const& entries, + std::vector const& backtraces, + std::vector& items) +{ + std::vector::const_iterator btIt = backtraces.begin(); + for (std::vector::const_iterator it = entries.begin(); + it != entries.end(); ++it, ++btIt) + { + cmGeneratorExpression ge(*btIt); + cmsys::auto_ptr cge = ge.Parse(*it); + items.push_back(new cmTargetInternals::TargetPropertyEntry(cge)); + } +} + +void cmTarget::Compute() +{ + CreatePropertyGeneratorExpressions( + this->Internal->IncludeDirectoriesEntries, + this->Internal->IncludeDirectoriesBacktraces, + this->Internal->IncludeDirectoriesItems); +} + //---------------------------------------------------------------------------- void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile) { @@ -1666,12 +1691,11 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) } else if(prop == "INCLUDE_DIRECTORIES") { + this->Internal->IncludeDirectoriesEntries.clear(); + this->Internal->IncludeDirectoriesBacktraces.clear(); + this->Internal->IncludeDirectoriesEntries.push_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - deleteAndClear(this->Internal->IncludeDirectoriesEntries); - cmsys::auto_ptr cge = ge.Parse(value); - this->Internal->IncludeDirectoriesEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); + this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt); } else if(prop == "COMPILE_OPTIONS") { @@ -1764,10 +1788,9 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, } else if(prop == "INCLUDE_DIRECTORIES") { + this->Internal->IncludeDirectoriesEntries.push_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - this->Internal->IncludeDirectoriesEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); + this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt); } else if(prop == "COMPILE_OPTIONS") { @@ -1887,14 +1910,16 @@ void cmTarget::InsertInclude(std::string const& entry, cmListFileBacktrace const& bt, bool before) { - cmGeneratorExpression ge(bt); + std::vector::iterator position = + before ? this->Internal->IncludeDirectoriesEntries.begin() + : this->Internal->IncludeDirectoriesEntries.end(); - std::vector::iterator position - = before ? this->Internal->IncludeDirectoriesEntries.begin() - : this->Internal->IncludeDirectoriesEntries.end(); + std::vector::iterator btPosition = + before ? this->Internal->IncludeDirectoriesBacktraces.begin() + : this->Internal->IncludeDirectoriesBacktraces.end(); - this->Internal->IncludeDirectoriesEntries.insert(position, - new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry))); + this->Internal->IncludeDirectoriesEntries.insert(position, entry); + this->Internal->IncludeDirectoriesBacktraces.insert(btPosition, bt); } //---------------------------------------------------------------------------- @@ -2083,7 +2108,7 @@ cmTarget::GetIncludeDirectories(const std::string& config, } processIncludeDirectories(this, - this->Internal->IncludeDirectoriesEntries, + this->Internal->IncludeDirectoriesItems, includes, uniqueIncludes, &dagChecker, @@ -2899,7 +2924,7 @@ const char *cmTarget::GetProperty(const std::string& prop, } static std::string output; - MakePropertyList(output, this->Internal->IncludeDirectoriesEntries); + output = cmJoin(this->Internal->IncludeDirectoriesEntries, ";"); return output.c_str(); } else if(prop == propCOMPILE_FEATURES) @@ -4805,7 +4830,7 @@ cmTargetInternalPointer //---------------------------------------------------------------------------- cmTargetInternalPointer::~cmTargetInternalPointer() { - cmDeleteAll(this->Pointer->IncludeDirectoriesEntries); + cmDeleteAll(this->Pointer->IncludeDirectoriesItems); cmDeleteAll(this->Pointer->CompileOptionsEntries); cmDeleteAll(this->Pointer->CompileFeaturesEntries); cmDeleteAll(this->Pointer->CompileDefinitionsEntries); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index c5918ba7b..490aaa350 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -132,6 +132,8 @@ public: void AddPostBuildCommand(cmCustomCommand const &cmd) {this->PostBuildCommands.push_back(cmd);} + void Compute(); + /** * Get the list of the source files used by this target */