diff options
24 files changed, 303 insertions, 248 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 92fee8a..428b364 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -288,6 +288,7 @@ set(SRCS cmInstallDirectoryGenerator.h cmInstallDirectoryGenerator.cxx cmLinkedTree.h + cmLinkItem.h cmListFileCache.cxx cmListFileCache.h cmListFileLexer.c diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index df17741..40653ad 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 3) -set(CMake_VERSION_PATCH 20150810) +set(CMake_VERSION_PATCH 20150811) #set(CMake_VERSION_RC 1) diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index c3f36af..c16472e 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -14,6 +14,7 @@ #include "cmComputeLinkDepends.h" #include "cmOrderDirectories.h" +#include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" #include "cmState.h" #include "cmOutputConverter.h" @@ -248,7 +249,8 @@ cmComputeLinkInformation // Store context information. this->Target = target; this->Makefile = this->Target->Target->GetMakefile(); - this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); + this->GlobalGenerator = + this->Target->GetLocalGenerator()->GetGlobalGenerator(); this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); // Check whether to recognize OpenBSD-style library versioned names. @@ -540,9 +542,7 @@ bool cmComputeLinkInformation::Compute() i != wrongItems.end(); ++i) { cmTarget const* tgt = *i; - cmGeneratorTarget *gtgt = tgt->GetMakefile() - ->GetGlobalGenerator() - ->GetGeneratorTarget(tgt); + cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt); bool implib = (this->UseImportLibrary && (tgt->GetType() == cmTarget::SHARED_LIBRARY)); @@ -646,9 +646,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item, if(tgt && tgt->IsLinkable()) { - cmGeneratorTarget *gtgt = tgt->GetMakefile() - ->GetGlobalGenerator() - ->GetGeneratorTarget(tgt); + cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt); // This is a CMake target. Ask the target for its real name. if(impexe && this->LoaderFlag) { @@ -762,7 +760,7 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item, return; } - cmGeneratorTarget *gtgt = 0; + cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(tgt); // Get a full path to the dependent shared library. // Add it to the runtime path computation so that the target being @@ -1812,9 +1810,7 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath, // Try to get the soname of the library. Only files with this name // could possibly conflict. - cmGeneratorTarget *gtgt = target->GetMakefile() - ->GetGlobalGenerator() - ->GetGeneratorTarget(target); + cmGeneratorTarget *gtgt = this->GlobalGenerator->GetGeneratorTarget(target); std::string soName = gtgt->GetSOName(this->Config); const char* soname = soName.empty()? 0 : soName.c_str(); diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index cb150a7..fde8fb1 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -11,7 +11,6 @@ ============================================================================*/ #include "cmExportLibraryDependenciesCommand.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmGeneratedFileStream.h" #include "cmake.h" #include "cmVersion.h" @@ -82,15 +81,14 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const // the project. cmake* cm = this->Makefile->GetCMakeInstance(); cmGlobalGenerator* global = cm->GetGlobalGenerator(); - const std::vector<cmLocalGenerator *>& locals = global->GetLocalGenerators(); + const std::vector<cmMakefile*>& locals = global->GetMakefiles(); std::map<std::string, std::string> libDepsOld; std::map<std::string, std::string> libDepsNew; std::map<std::string, std::string> libTypes; - for(std::vector<cmLocalGenerator *>::const_iterator i = locals.begin(); + for(std::vector<cmMakefile*>::const_iterator i = locals.begin(); i != locals.end(); ++i) { - const cmLocalGenerator* gen = *i; - const cmTargets &tgts = gen->GetMakefile()->GetTargets(); + const cmTargets &tgts = (*i)->GetTargets(); for(cmTargets::const_iterator l = tgts.begin(); l != tgts.end(); ++l) { diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 44a9adb..03bc83a 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1120,7 +1120,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode } else if(!interfacePropertyName.empty()) { - if(cmTarget::LinkImplementationLibraries const* impl = + if(cmLinkImplementationLibraries const* impl = target->GetLinkImplementationLibraries(context->Config)) { linkedTargetsContent = diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index e490368..299c112 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -36,7 +36,7 @@ //---------------------------------------------------------------------------- void reportBadObjLib(std::vector<cmSourceFile*> const& badObjLib, - cmTarget *target, cmake *cm) + cmGeneratorTarget const* target, cmake *cm) { if(!badObjLib.empty()) { @@ -50,7 +50,7 @@ void reportBadObjLib(std::vector<cmSourceFile*> const& badObjLib, e << "but may contain only sources that compile, header files, and " "other files that would not affect linking of a normal library."; cm->IssueMessage(cmake::FATAL_ERROR, e.str(), - target->GetBacktrace()); + target->Target->GetBacktrace()); } } @@ -133,14 +133,14 @@ struct TagVisitor { DataType& Data; std::vector<cmSourceFile*> BadObjLibFiles; - cmTarget *Target; + cmGeneratorTarget const* Target; cmGlobalGenerator *GlobalGenerator; cmsys::RegularExpression Header; bool IsObjLib; - TagVisitor(cmTarget *target, DataType& data) + TagVisitor(cmGeneratorTarget const* target, DataType& data) : Data(data), Target(target), - GlobalGenerator(target->GetMakefile()->GetGlobalGenerator()), + GlobalGenerator(target->GetLocalGenerator()->GetGlobalGenerator()), Header(CM_HEADER_REGEX), IsObjLib(target->GetType() == cmTarget::OBJECT_LIBRARY) { @@ -234,7 +234,7 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) { this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = lg; - this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); + this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); } cmGeneratorTarget::~cmGeneratorTarget() @@ -362,7 +362,7 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget const* depTgt, { \ std::vector<cmSourceFile*> sourceFiles; \ this->Target->GetSourceFiles(sourceFiles, config); \ - TagVisitor<DATA ## Tag DATATYPE> visitor(this->Target, data); \ + TagVisitor<DATA ## Tag DATATYPE> visitor(this, data); \ for(std::vector<cmSourceFile*>::const_iterator si = sourceFiles.begin(); \ si != sourceFiles.end(); ++si) \ { \ @@ -1507,7 +1507,7 @@ cmGeneratorTarget::GetLinkImplementationClosure( tgts.Done = true; std::set<cmTarget const*> emitted; - cmTarget::LinkImplementationLibraries const* impl + cmLinkImplementationLibraries const* impl = this->Target->GetLinkImplementationLibraries(config); for(std::vector<cmLinkImplItem>::const_iterator @@ -1557,7 +1557,7 @@ cmTargetTraceDependencies { // Convenience. this->Makefile = this->Target->GetMakefile(); - this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); + this->GlobalGenerator = target->GetLocalGenerator()->GetGlobalGenerator(); this->CurrentEntry = 0; // Queue all the source files already specified for the target. @@ -1945,8 +1945,7 @@ void cmGeneratorTarget::GenerateTargetManifest( { return; } - cmMakefile* mf = this->Target->GetMakefile(); - cmGlobalGenerator* gg = mf->GetGlobalGenerator(); + cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator(); // Get the names. std::string name; diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index c056d95..2558876 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -51,10 +51,8 @@ bool cmGetDirectoryPropertyCommand sd = cmSystemTools::CollapseFullPath(sd); // lookup the makefile from the directory name - cmLocalGenerator *lg = - this->Makefile->GetGlobalGenerator()-> - FindLocalGenerator(sd); - if (!lg) + dir = this->Makefile->GetGlobalGenerator()->FindMakefile(sd); + if (!dir) { this->SetError ("DIRECTORY argument provided but requested directory not found. " @@ -62,7 +60,6 @@ bool cmGetDirectoryPropertyCommand "it is valid but has not been processed yet."); return false; } - dir = lg->GetMakefile(); ++i; } diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 33d638b..4c42f53 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -262,13 +262,8 @@ bool cmGetPropertyCommand::HandleDirectoryMode() dir = cmSystemTools::CollapseFullPath(dir); // Lookup the generator. - if(cmLocalGenerator* lg = - (this->Makefile->GetGlobalGenerator()->FindLocalGenerator(dir))) - { - // Use the makefile for the directory found. - mf = lg->GetMakefile(); - } - else + mf = this->Makefile->GetGlobalGenerator()->FindMakefile(dir); + if (!mf) { // Could not find the directory. this->SetError diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 3c818ff..cda26cd 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1129,6 +1129,7 @@ void cmGlobalGenerator::Configure() // start with this directory cmLocalGenerator *lg = this->MakeLocalGenerator(); + this->Makefiles.push_back(lg->GetMakefile()); this->LocalGenerators.push_back(lg); // set the Start directories @@ -1147,9 +1148,9 @@ void cmGlobalGenerator::Configure() // update the cache entry for the number of local generators, this is used // for progress char num[100]; - sprintf(num,"%d",static_cast<int>(this->LocalGenerators.size())); + sprintf(num,"%d",static_cast<int>(this->Makefiles.size())); this->GetCMakeInstance()->AddCacheEntry - ("CMAKE_NUMBER_OF_LOCAL_GENERATORS", num, + ("CMAKE_NUMBER_OF_MAKEFILES", num, "number of local generators", cmState::INTERNAL); // check for link libraries and include directories containing "NOTFOUND" @@ -1192,9 +1193,9 @@ void cmGlobalGenerator::Configure() cmTargets globalTargets; this->CreateDefaultGlobalTargets(&globalTargets); - for (i = 0; i < this->LocalGenerators.size(); ++i) + for (i = 0; i < this->Makefiles.size(); ++i) { - cmMakefile* mf = this->LocalGenerators[i]->GetMakefile(); + cmMakefile* mf = this->Makefiles[i]; cmTargets* targets = &(mf->GetTargets()); cmTargets::iterator tit; for ( tit = globalTargets.begin(); tit != globalTargets.end(); ++ tit ) @@ -1481,9 +1482,9 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens) void cmGlobalGenerator::FinalizeTargetCompileInfo() { // Construct per-target generator information. - for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) + for(unsigned int i=0; i < this->Makefiles.size(); ++i) { - cmMakefile *mf = this->LocalGenerators[i]->GetMakefile(); + cmMakefile *mf = this->Makefiles[i]; const cmStringRange noconfig_compile_definitions = mf->GetCompileDefinitionsEntries(); @@ -1549,6 +1550,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; @@ -1599,6 +1601,8 @@ void cmGlobalGenerator::ClearGeneratorMembers() cmDeleteAll(this->BuildExportSets); this->BuildExportSets.clear(); + this->Makefiles.clear(); + cmDeleteAll(this->LocalGenerators); this->LocalGenerators.clear(); @@ -1638,11 +1642,11 @@ void cmGlobalGenerator::CheckLocalGenerators() // std::set<std::string> notFoundMap; // after it is all done do a ConfigureFinalPass cmState* state = this->GetCMakeInstance()->GetState(); - for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) + for (unsigned int i = 0; i < this->Makefiles.size(); ++i) { - this->LocalGenerators[i]->GetMakefile()->ConfigureFinalPass(); + this->Makefiles[i]->ConfigureFinalPass(); cmTargets &targets = - this->LocalGenerators[i]->GetMakefile()->GetTargets(); + this->Makefiles[i]->GetTargets(); for (cmTargets::iterator l = targets.begin(); l != targets.end(); l++) { @@ -1697,15 +1701,14 @@ void cmGlobalGenerator::CheckLocalGenerators() } std::string text = notFoundMap[varName]; text += "\n used as include directory in directory "; - text += this->LocalGenerators[i] - ->GetMakefile()->GetCurrentSourceDirectory(); + text += this->Makefiles[i]->GetCurrentSourceDirectory(); notFoundMap[varName] = text; } } } this->CMakeInstance->UpdateProgress ("Configuring", 0.9f+0.1f*(static_cast<float>(i)+1.0f)/ - static_cast<float>(this->LocalGenerators.size())); + static_cast<float>(this->Makefiles.size())); } if(!notFoundMap.empty()) @@ -1739,9 +1742,9 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir, // take the bulk of the time, so try and guess some progress // by getting closer and closer to 100 without actually getting there. if (!this->CMakeInstance->GetState()->GetInitializedCacheValue - ("CMAKE_NUMBER_OF_LOCAL_GENERATORS")) + ("CMAKE_NUMBER_OF_MAKEFILES")) { - // If CMAKE_NUMBER_OF_LOCAL_GENERATORS is not set + // If CMAKE_NUMBER_OF_MAKEFILES is not set // we are in the first time progress and we have no // idea how long it will be. So, just move 1/10th of the way // there each time, and don't go over 95% @@ -1929,19 +1932,19 @@ std::string cmGlobalGenerator::GenerateCMakeBuildCommand( } //---------------------------------------------------------------------------- -void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg) +void cmGlobalGenerator::AddMakefile(cmMakefile *mf) { - this->LocalGenerators.push_back(lg); + this->Makefiles.push_back(mf); // update progress // estimate how many lg there will be const char *numGenC = this->CMakeInstance->GetState()->GetInitializedCacheValue - ("CMAKE_NUMBER_OF_LOCAL_GENERATORS"); + ("CMAKE_NUMBER_OF_MAKEFILES"); if (!numGenC) { - // If CMAKE_NUMBER_OF_LOCAL_GENERATORS is not set + // If CMAKE_NUMBER_OF_MAKEFILES is not set // we are in the first time progress and we have no // idea how long it will be. So, just move half way // there each time, and don't go over 95% @@ -1956,7 +1959,7 @@ void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg) } int numGen = atoi(numGenC); - float prog = 0.9f*static_cast<float>(this->LocalGenerators.size())/ + float prog = 0.9f*static_cast<float>(this->Makefiles.size())/ static_cast<float>(numGen); if (prog > 0.9f) { @@ -1965,6 +1968,12 @@ void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg) this->CMakeInstance->UpdateProgress("Configuring", prog); } +//---------------------------------------------------------------------------- +void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg) +{ + this->LocalGenerators.push_back(lg); +} + void cmGlobalGenerator::AddInstallComponent(const char* component) { if(component && *component) @@ -2054,10 +2063,10 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, } bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, - cmTarget const& target) const + cmGeneratorTarget* target) const { - if(target.GetType() == cmTarget::INTERFACE_LIBRARY - || target.GetPropertyAsBool("EXCLUDE_FROM_ALL")) + if(target->GetType() == cmTarget::INTERFACE_LIBRARY + || target->Target->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { // This target is excluded from its directory. return true; @@ -2066,7 +2075,7 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, { // This target is included in its directory. Check whether the // directory is excluded. - return this->IsExcluded(root, target.GetMakefile()->GetLocalGenerator()); + return this->IsExcluded(root, target->GetLocalGenerator()); } } @@ -2127,15 +2136,16 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap() { cmTarget const& target = t->second; + cmGeneratorTarget* gt = this->GetGeneratorTarget(&target); + // Consider the directory containing the target and all its // parents until something excludes the target. - for(cmLocalGenerator* clg = lg; clg && !this->IsExcluded(clg, target); + for(cmLocalGenerator* clg = lg; clg && !this->IsExcluded(clg, gt); clg = clg->GetParent()) { // This local generator includes the target. std::set<cmGeneratorTarget const*>& targetSet = this->LocalGeneratorToTargetMap[clg]; - cmGeneratorTarget* gt = this->GetGeneratorTarget(&target); targetSet.insert(gt); // Add dependencies of the included target. An excluded @@ -2152,6 +2162,20 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap() } } +cmMakefile* +cmGlobalGenerator::FindMakefile(const std::string& start_dir) const +{ + for(std::vector<cmMakefile*>::const_iterator it = + this->Makefiles.begin(); it != this->Makefiles.end(); ++it) + { + std::string sd = (*it)->GetCurrentSourceDirectory(); + if (sd == start_dir) + { + return *it; + } + } + return 0; +} ///! Find a local generator by its startdirectory cmLocalGenerator* @@ -2239,7 +2263,7 @@ inline std::string removeQuotes(const std::string& s) void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) { - cmMakefile* mf = this->LocalGenerators[0]->GetMakefile(); + cmMakefile* mf = this->Makefiles[0]; const char* cmakeCfgIntDir = this->GetCMakeCFGIntDir(); // CPack @@ -2812,9 +2836,9 @@ cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs, } // Shorten the output name (in expected use case). - cmLocalGenerator* lg = this->GetLocalGenerators()[0]; - std::string fname = lg->Convert(outputs[0], - cmLocalGenerator::HOME_OUTPUT); + cmOutputConverter converter(this->GetMakefiles()[0]->GetStateSnapshot()); + std::string fname = converter.Convert( + outputs[0], cmLocalGenerator::HOME_OUTPUT); // Associate the hash with this output. this->RuleHashes[fname] = hash; diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index ec916ae..a13bede 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -173,6 +173,8 @@ public: cmake *GetCMakeInstance() const { return this->CMakeInstance; } void SetConfiguredFilesPath(cmGlobalGenerator* gen); + const std::vector<cmMakefile*>& GetMakefiles() const { + return this->Makefiles;} const std::vector<cmLocalGenerator *>& GetLocalGenerators() const { return this->LocalGenerators;} @@ -184,6 +186,7 @@ public: void SetCurrentMakefile(cmMakefile* mf) {this->CurrentMakefile = mf;} + void AddMakefile(cmMakefile *mf); void AddLocalGenerator(cmLocalGenerator *lg); ///! Set an generator for an "external makefile based project" @@ -253,6 +256,7 @@ public: that is a framework. */ bool NameResolvesToFramework(const std::string& libname) const; + cmMakefile* FindMakefile(const std::string& start_dir) const; ///! Find a local generator by its startdirectory cmLocalGenerator* FindLocalGenerator(const std::string& start_dir) const; @@ -393,7 +397,7 @@ protected: void FillProjectMap(); void CheckLocalGenerators(); bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const; - bool IsExcluded(cmLocalGenerator* root, cmTarget const& target) const; + bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) const; void FillLocalGeneratorToTargetMap(); void CreateDefaultGlobalTargets(cmTargets* targets); cmTarget CreateGlobalTarget(const std::string& name, const char* message, @@ -404,6 +408,7 @@ protected: std::string FindMakeProgramFile; std::string ConfiguredFilesPath; cmake *CMakeInstance; + std::vector<cmMakefile*> Makefiles; std::vector<cmLocalGenerator *> LocalGenerators; cmMakefile* CurrentMakefile; // map from project name to vector of local generators in that project diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index a1df1c2..f103801 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -289,7 +289,7 @@ public: const std::vector<cmLocalGenerator*>& GetLocalGenerators() const { return LocalGenerators; } - bool IsExcluded(cmLocalGenerator* root, cmTarget& target) { + bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) { return cmGlobalGenerator::IsExcluded(root, target); } int GetRuleCmdLength(const std::string& name) { diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 69747a4..76d059ee 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -821,7 +821,7 @@ cmGlobalUnixMakefileGenerator3 localName, depends, commands, true); // add the all/all dependency - if(!this->IsExcluded(this->LocalGenerators[0], *gtarget->Target)) + if(!this->IsExcluded(this->LocalGenerators[0], gtarget)) { depends.clear(); depends.push_back(localName); @@ -889,7 +889,7 @@ cmGlobalUnixMakefileGenerator3 "Pre-install relink rule for target.", localName, depends, commands, true); - if(!this->IsExcluded(this->LocalGenerators[0], *gtarget->Target)) + if(!this->IsExcluded(this->LocalGenerators[0], gtarget)) { depends.clear(); depends.push_back(localName); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index d5a5585..51dcab0 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 2f9d79a..c38a35a 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); @@ -111,17 +112,19 @@ bool cmGlobalVisualStudioGenerator::Compute() for(std::vector<cmLocalGenerator*>::iterator i = gen.begin(); i != gen.end(); ++i) { - cmTargets& targets = (*i)->GetMakefile()->GetTargets(); - for(cmTargets::iterator t = targets.begin(); + cmGeneratorTargetsType targets = + (*i)->GetMakefile()->GetGeneratorTargets(); + for(cmGeneratorTargetsType::iterator t = targets.begin(); t != targets.end(); ++t) { - if (t->second.GetType() == cmTarget::GLOBAL_TARGET) + if (t->second->GetType() == cmTarget::GLOBAL_TARGET + || t->first->IsImported()) { continue; } if(!this->IsExcluded(gen[0], t->second)) { - allBuild->AddUtility(t->second.GetName()); + allBuild->AddUtility(t->second->GetName()); } } } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 5006828..39933cb 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/cmLinkItem.h b/Source/cmLinkItem.h new file mode 100644 index 0000000..a5427de --- /dev/null +++ b/Source/cmLinkItem.h @@ -0,0 +1,59 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2004-2015 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ + +#ifndef cmLinkItem_h +#define cmLinkItem_h + +#include "cmListFileCache.h" + +class cmTarget; + +// Basic information about each link item. +class cmLinkItem: public std::string +{ + typedef std::string std_string; +public: + cmLinkItem(): std_string(), Target(0) {} + cmLinkItem(const std_string& n, + cmTarget const* t): std_string(n), Target(t) {} + cmLinkItem(cmLinkItem const& r): std_string(r), Target(r.Target) {} + cmTarget const* Target; +}; + +class cmLinkImplItem: public cmLinkItem +{ +public: + cmLinkImplItem(): cmLinkItem(), Backtrace(), FromGenex(false) {} + cmLinkImplItem(std::string const& n, + cmTarget const* t, + cmListFileBacktrace const& bt, + bool fromGenex): + cmLinkItem(n, t), Backtrace(bt), FromGenex(fromGenex) {} + cmLinkImplItem(cmLinkImplItem const& r): + cmLinkItem(r), Backtrace(r.Backtrace), FromGenex(r.FromGenex) {} + cmListFileBacktrace Backtrace; + bool FromGenex; +}; + +/** The link implementation specifies the direct library + dependencies needed by the object files of the target. */ +struct cmLinkImplementationLibraries +{ + // Libraries linked directly in this configuration. + std::vector<cmLinkImplItem> Libraries; + + // Libraries linked directly in other configurations. + // Needed only for OLD behavior of CMP0003. + std::vector<cmLinkItem> WrongConfigLibraries; +}; + +#endif diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index aaad075..cfca418 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -90,7 +90,7 @@ void cmLocalNinjaGenerator::Generate() // Add the target to "all" if required. if (!this->GetGlobalNinjaGenerator()->IsExcluded( this->GetGlobalNinjaGenerator()->GetLocalGenerators()[0], - *t->second->Target)) + t->second)) this->GetGlobalNinjaGenerator()->AddDependencyToAll(t->second->Target); delete tg; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 60a11e1..85bc493 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1857,6 +1857,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, // create a new local generator and set its parent cmLocalGenerator *lg2 = this->GetGlobalGenerator() ->MakeLocalGenerator(newSnapshot, this->LocalGenerator); + this->GetGlobalGenerator()->AddMakefile(lg2->GetMakefile()); this->GetGlobalGenerator()->AddLocalGenerator(lg2); cmMakefile* subMf = lg2->GetMakefile(); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 27e5bce..1c4da00 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -114,10 +114,6 @@ public: bool GetIsSourceFileTryCompile() const; - ///! Get the current makefile generator. - cmLocalGenerator* GetLocalGenerator() const - { return this->LocalGenerator;} - /** * Help enforce global target name uniqueness. */ diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index f1ba2f4..4eb9b13 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -369,7 +369,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg, #if defined(_WIN32) && !defined(__CYGWIN__) bool usePRE_BUILD = false; - cmGlobalGenerator* gg = makefile->GetGlobalGenerator(); + cmGlobalGenerator* gg = lg->GetGlobalGenerator(); if(gg->GetName().find("Visual Studio") != std::string::npos) { cmGlobalVisualStudioGenerator* vsgg = @@ -396,7 +396,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg, std::vector<std::string> rcc_output; bool const isNinja = - makefile->GetGlobalGenerator()->GetName() == "Ninja"; + lg->GetGlobalGenerator()->GetName() == "Ninja"; if(isNinja #if defined(_WIN32) && !defined(__CYGWIN__) || usePRE_BUILD @@ -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/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 31e460f..17ad475 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -205,14 +205,8 @@ bool cmSetPropertyCommand::HandleDirectoryMode() // The local generators are associated with collapsed paths. dir = cmSystemTools::CollapseFullPath(dir); - // Lookup the generator. - if(cmLocalGenerator* lg = - this->Makefile->GetGlobalGenerator()->FindLocalGenerator(dir)) - { - // Use the makefile for the directory found. - mf = lg->GetMakefile(); - } - else + mf = this->Makefile->GetGlobalGenerator()->FindMakefile(dir); + if (!mf) { // Could not find the directory. this->SetError diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1f8f07a..d3170e4 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -168,10 +168,18 @@ public: const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge; cmLinkImplItem const& LinkImplItem; }; - std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries; - std::vector<TargetPropertyEntry*> CompileOptionsEntries; - std::vector<TargetPropertyEntry*> CompileFeaturesEntries; - std::vector<TargetPropertyEntry*> CompileDefinitionsEntries; + std::vector<std::string> IncludeDirectoriesEntries; + std::vector<cmListFileBacktrace> IncludeDirectoriesBacktraces; + std::vector<TargetPropertyEntry*> IncludeDirectoriesItems; + std::vector<std::string> CompileOptionsEntries; + std::vector<cmListFileBacktrace> CompileOptionsBacktraces; + std::vector<TargetPropertyEntry*> CompileOptionsItems; + std::vector<std::string> CompileFeaturesEntries; + std::vector<cmListFileBacktrace> CompileFeaturesBacktraces; + std::vector<TargetPropertyEntry*> CompileFeaturesItems; + std::vector<std::string> CompileDefinitionsEntries; + std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces; + std::vector<TargetPropertyEntry*> CompileDefinitionsItems; std::vector<TargetPropertyEntry*> SourceEntries; std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries; @@ -183,14 +191,6 @@ public: cmLinkImplItem cmTargetInternals::TargetPropertyEntry::NoLinkImplItem; //---------------------------------------------------------------------------- -static void deleteAndClear( - std::vector<cmTargetInternals::TargetPropertyEntry*> &entries) -{ - cmDeleteAll(entries); - entries.clear(); -} - -//---------------------------------------------------------------------------- cmTargetInternals::~cmTargetInternals() { } @@ -366,13 +366,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<std::string> parentSystemIncludes = this->Makefile->GetSystemIncludeDirectories(); @@ -384,13 +384,12 @@ void cmTarget::SetMakefile(cmMakefile* mf) const cmBacktraceRange parentOptionsBts = this->Makefile->GetCompileOptionsBacktraces(); - btIt = parentOptionsBts.begin(); - for (cmStringRange::const_iterator it - = parentOptions.begin(); - it != parentOptions.end(); ++it, ++btIt) - { - this->InsertCompileOption(*it, *btIt); - } + this->Internal->CompileOptionsEntries.insert( + this->Internal->CompileOptionsEntries.end(), + parentOptions.begin(), parentOptions.end()); + this->Internal->CompileOptionsBacktraces.insert( + this->Internal->CompileOptionsBacktraces.end(), + parentOptionsBts.begin(), parentOptionsBts.end()); } if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY) @@ -438,6 +437,44 @@ void cmTarget::SetMakefile(cmMakefile* mf) } } +void CreatePropertyGeneratorExpressions( + std::vector<std::string> const& entries, + std::vector<cmListFileBacktrace> const& backtraces, + std::vector<cmTargetInternals::TargetPropertyEntry*>& items) +{ + std::vector<cmListFileBacktrace>::const_iterator btIt = backtraces.begin(); + for (std::vector<std::string>::const_iterator it = entries.begin(); + it != entries.end(); ++it, ++btIt) + { + cmGeneratorExpression ge(*btIt); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*it); + items.push_back(new cmTargetInternals::TargetPropertyEntry(cge)); + } +} + +void cmTarget::Compute() +{ + CreatePropertyGeneratorExpressions( + this->Internal->IncludeDirectoriesEntries, + this->Internal->IncludeDirectoriesBacktraces, + this->Internal->IncludeDirectoriesItems); + + CreatePropertyGeneratorExpressions( + this->Internal->CompileOptionsEntries, + this->Internal->CompileOptionsBacktraces, + this->Internal->CompileOptionsItems); + + CreatePropertyGeneratorExpressions( + this->Internal->CompileFeaturesEntries, + this->Internal->CompileFeaturesBacktraces, + this->Internal->CompileFeaturesItems); + + CreatePropertyGeneratorExpressions( + this->Internal->CompileDefinitionsEntries, + this->Internal->CompileDefinitionsBacktraces, + this->Internal->CompileDefinitionsItems); +} + //---------------------------------------------------------------------------- void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile) { @@ -765,7 +802,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files, this->LinkImplementationLanguageIsContextDependent = false; } - deleteAndClear(linkInterfaceSourcesEntries); + cmDeleteAll(linkInterfaceSourcesEntries); } //---------------------------------------------------------------------------- @@ -1666,39 +1703,35 @@ 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<cmCompiledGeneratorExpression> cge = ge.Parse(value); - this->Internal->IncludeDirectoriesEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); + this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt); } else if(prop == "COMPILE_OPTIONS") { + this->Internal->CompileOptionsEntries.clear(); + this->Internal->CompileOptionsBacktraces.clear(); + this->Internal->CompileOptionsEntries.push_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - deleteAndClear(this->Internal->CompileOptionsEntries); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); - this->Internal->CompileOptionsEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); + this->Internal->CompileOptionsBacktraces.push_back(lfbt); } else if(prop == "COMPILE_FEATURES") { + this->Internal->CompileFeaturesEntries.clear(); + this->Internal->CompileFeaturesBacktraces.clear(); + this->Internal->CompileFeaturesEntries.push_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - deleteAndClear(this->Internal->CompileFeaturesEntries); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); - this->Internal->CompileFeaturesEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); + this->Internal->CompileFeaturesBacktraces.push_back(lfbt); } else if(prop == "COMPILE_DEFINITIONS") { + this->Internal->CompileDefinitionsEntries.clear(); + this->Internal->CompileDefinitionsBacktraces.clear(); + this->Internal->CompileDefinitionsEntries.push_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - deleteAndClear(this->Internal->CompileDefinitionsEntries); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); - this->Internal->CompileDefinitionsEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); + this->Internal->CompileDefinitionsBacktraces.push_back(lfbt); } else if(prop == "EXPORT_NAME" && this->IsImported()) { @@ -1764,31 +1797,27 @@ 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") { + this->Internal->CompileOptionsEntries.push_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - this->Internal->CompileOptionsEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); + this->Internal->CompileOptionsBacktraces.push_back(lfbt); } else if(prop == "COMPILE_FEATURES") { + this->Internal->CompileFeaturesEntries.push_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - this->Internal->CompileFeaturesEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); + this->Internal->CompileFeaturesBacktraces.push_back(lfbt); } else if(prop == "COMPILE_DEFINITIONS") { + this->Internal->CompileDefinitionsEntries.push_back(value); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmGeneratorExpression ge(lfbt); - this->Internal->CompileDefinitionsEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); + this->Internal->CompileDefinitionsBacktraces.push_back(lfbt); } else if(prop == "EXPORT_NAME" && this->IsImported()) { @@ -1887,14 +1916,16 @@ void cmTarget::InsertInclude(std::string const& entry, cmListFileBacktrace const& bt, bool before) { - cmGeneratorExpression ge(bt); + std::vector<std::string>::iterator position = + before ? this->Internal->IncludeDirectoriesEntries.begin() + : this->Internal->IncludeDirectoriesEntries.end(); - std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position - = before ? this->Internal->IncludeDirectoriesEntries.begin() - : this->Internal->IncludeDirectoriesEntries.end(); + std::vector<cmListFileBacktrace>::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); } //---------------------------------------------------------------------------- @@ -1902,24 +1933,24 @@ void cmTarget::InsertCompileOption(std::string const& entry, cmListFileBacktrace const& bt, bool before) { - cmGeneratorExpression ge(bt); + std::vector<std::string>::iterator position = + before ? this->Internal->CompileOptionsEntries.begin() + : this->Internal->CompileOptionsEntries.end(); - std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position - = before ? this->Internal->CompileOptionsEntries.begin() - : this->Internal->CompileOptionsEntries.end(); + std::vector<cmListFileBacktrace>::iterator btPosition = + before ? this->Internal->CompileOptionsBacktraces.begin() + : this->Internal->CompileOptionsBacktraces.end(); - this->Internal->CompileOptionsEntries.insert(position, - new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry))); + this->Internal->CompileOptionsEntries.insert(position, entry); + this->Internal->CompileOptionsBacktraces.insert(btPosition, bt); } //---------------------------------------------------------------------------- void cmTarget::InsertCompileDefinition(std::string const& entry, cmListFileBacktrace const& bt) { - cmGeneratorExpression ge(bt); - - this->Internal->CompileDefinitionsEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry))); + this->Internal->CompileDefinitionsEntries.push_back(entry); + this->Internal->CompileDefinitionsBacktraces.push_back(bt); } //---------------------------------------------------------------------------- @@ -2083,7 +2114,7 @@ cmTarget::GetIncludeDirectories(const std::string& config, } processIncludeDirectories(this, - this->Internal->IncludeDirectoriesEntries, + this->Internal->IncludeDirectoriesItems, includes, uniqueIncludes, &dagChecker, @@ -2099,7 +2130,8 @@ cmTarget::GetIncludeDirectories(const std::string& config, if(this->Makefile->IsOn("APPLE")) { - LinkImplementation const* impl = this->GetLinkImplementation(config); + cmLinkImplementationLibraries const* impl = + this->GetLinkImplementationLibraries(config); for(std::vector<cmLinkImplItem>::const_iterator it = impl->Libraries.begin(); it != impl->Libraries.end(); ++it) @@ -2132,7 +2164,7 @@ cmTarget::GetIncludeDirectories(const std::string& config, debugIncludes, language); - deleteAndClear(linkInterfaceIncludeDirectoriesEntries); + cmDeleteAll(linkInterfaceIncludeDirectoriesEntries); return includes; } @@ -2229,7 +2261,7 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result, } processCompileOptions(this, - this->Internal->CompileOptionsEntries, + this->Internal->CompileOptionsItems, result, uniqueOptions, &dagChecker, @@ -2253,7 +2285,7 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result, debugOptions, language); - deleteAndClear(linkInterfaceCompileOptionsEntries); + cmDeleteAll(linkInterfaceCompileOptionsEntries); } //---------------------------------------------------------------------------- @@ -2300,7 +2332,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list, } processCompileDefinitions(this, - this->Internal->CompileDefinitionsEntries, + this->Internal->CompileDefinitionsItems, list, uniqueOptions, &dagChecker, @@ -2355,7 +2387,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list, debugDefines, language); - deleteAndClear(linkInterfaceCompileDefinitionsEntries); + cmDeleteAll(linkInterfaceCompileDefinitionsEntries); } //---------------------------------------------------------------------------- @@ -2401,7 +2433,7 @@ void cmTarget::GetCompileFeatures(std::vector<std::string> &result, } processCompileFeatures(this, - this->Internal->CompileFeaturesEntries, + this->Internal->CompileFeaturesItems, result, uniqueFeatures, &dagChecker, @@ -2422,7 +2454,7 @@ void cmTarget::GetCompileFeatures(std::vector<std::string> &result, config, debugFeatures); - deleteAndClear(linkInterfaceCompileFeaturesEntries); + cmDeleteAll(linkInterfaceCompileFeaturesEntries); } //---------------------------------------------------------------------------- @@ -2708,22 +2740,6 @@ bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const } //---------------------------------------------------------------------------- -static void MakePropertyList(std::string& output, - std::vector<cmTargetInternals::TargetPropertyEntry*> const& values) -{ - output = ""; - std::string sep; - for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator - it = values.begin(), end = values.end(); - it != end; ++it) - { - output += sep; - output += (*it)->ge->GetInput(); - sep = ";"; - } -} - -//---------------------------------------------------------------------------- const char *cmTarget::GetProperty(const std::string& prop) const { return this->GetProperty(prop, this->Makefile); @@ -2898,7 +2914,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) @@ -2909,7 +2925,7 @@ const char *cmTarget::GetProperty(const std::string& prop, } static std::string output; - MakePropertyList(output, this->Internal->CompileFeaturesEntries); + output = cmJoin(this->Internal->CompileFeaturesEntries, ";"); return output.c_str(); } else if(prop == propCOMPILE_OPTIONS) @@ -2920,7 +2936,7 @@ const char *cmTarget::GetProperty(const std::string& prop, } static std::string output; - MakePropertyList(output, this->Internal->CompileOptionsEntries); + output = cmJoin(this->Internal->CompileOptionsEntries, ";"); return output.c_str(); } else if(prop == propCOMPILE_DEFINITIONS) @@ -2931,7 +2947,7 @@ const char *cmTarget::GetProperty(const std::string& prop, } static std::string output; - MakePropertyList(output, this->Internal->CompileDefinitionsEntries); + output = cmJoin(this->Internal->CompileDefinitionsEntries, ";"); return output.c_str(); } else if (prop == propIMPORTED) @@ -3381,7 +3397,7 @@ bool cmTarget::HaveBuildTreeRPATH(const std::string& config) const { return false; } - if(LinkImplementationLibraries const* impl = + if(cmLinkImplementationLibraries const* impl = this->GetLinkImplementationLibraries(config)) { return !impl->Libraries.empty(); @@ -4331,7 +4347,7 @@ cmTargetInternals::ComputeLinkInterfaceLibraries( // to the link implementation. { // The link implementation is the default link interface. - cmTarget::LinkImplementationLibraries const* impl = + cmLinkImplementationLibraries const* impl = thisTarget->GetLinkImplementationLibrariesInternal(config, headTarget); iface.Libraries.insert(iface.Libraries.end(), impl->Libraries.begin(), impl->Libraries.end()); @@ -4431,7 +4447,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, || thisTarget->GetPolicyStatusCMP0022() == cmPolicies::OLD) { // The link implementation is the default link interface. - cmTarget::LinkImplementationLibraries const* + cmLinkImplementationLibraries const* impl = thisTarget->GetLinkImplementationLibrariesInternal(config, headTarget); iface.ImplementationIsInterface = true; @@ -4482,7 +4498,7 @@ void cmTargetInternals::AddInterfaceEntries( cmTarget const* thisTarget, std::string const& config, std::string const& prop, std::vector<TargetPropertyEntry*>& entries) { - if(cmTarget::LinkImplementationLibraries const* impl = + if(cmLinkImplementationLibraries const* impl = thisTarget->GetLinkImplementationLibraries(config)) { for (std::vector<cmLinkImplItem>::const_iterator @@ -4532,14 +4548,14 @@ cmTarget::GetLinkImplementation(const std::string& config) const } //---------------------------------------------------------------------------- -cmTarget::LinkImplementationLibraries const* +cmLinkImplementationLibraries const* cmTarget::GetLinkImplementationLibraries(const std::string& config) const { return this->GetLinkImplementationLibrariesInternal(config, this); } //---------------------------------------------------------------------------- -cmTarget::LinkImplementationLibraries const* +cmLinkImplementationLibraries const* cmTarget::GetLinkImplementationLibrariesInternal(const std::string& config, cmTarget const* head) const { @@ -4804,10 +4820,10 @@ cmTargetInternalPointer //---------------------------------------------------------------------------- cmTargetInternalPointer::~cmTargetInternalPointer() { - cmDeleteAll(this->Pointer->IncludeDirectoriesEntries); - cmDeleteAll(this->Pointer->CompileOptionsEntries); - cmDeleteAll(this->Pointer->CompileFeaturesEntries); - cmDeleteAll(this->Pointer->CompileDefinitionsEntries); + cmDeleteAll(this->Pointer->IncludeDirectoriesItems); + cmDeleteAll(this->Pointer->CompileOptionsItems); + cmDeleteAll(this->Pointer->CompileFeaturesItems); + cmDeleteAll(this->Pointer->CompileDefinitionsItems); cmDeleteAll(this->Pointer->SourceEntries); delete this->Pointer; } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index e3fbdfd..490aaa3 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -16,6 +16,7 @@ #include "cmPropertyMap.h" #include "cmPolicies.h" #include "cmListFileCache.h" +#include "cmLinkItem.h" #include <cmsys/auto_ptr.hxx> #if defined(CMAKE_BUILD_WITH_CMAKE) @@ -52,32 +53,6 @@ class cmTarget; class cmGeneratorTarget; class cmTargetTraceDependencies; -// Basic information about each link item. -class cmLinkItem: public std::string -{ - typedef std::string std_string; -public: - cmLinkItem(): std_string(), Target(0) {} - cmLinkItem(const std_string& n, - cmTarget const* t): std_string(n), Target(t) {} - cmLinkItem(cmLinkItem const& r): std_string(r), Target(r.Target) {} - cmTarget const* Target; -}; -class cmLinkImplItem: public cmLinkItem -{ -public: - cmLinkImplItem(): cmLinkItem(), Backtrace(), FromGenex(false) {} - cmLinkImplItem(std::string const& n, - cmTarget const* t, - cmListFileBacktrace const& bt, - bool fromGenex): - cmLinkItem(n, t), Backtrace(bt), FromGenex(fromGenex) {} - cmLinkImplItem(cmLinkImplItem const& r): - cmLinkItem(r), Backtrace(r.Backtrace), FromGenex(r.FromGenex) {} - cmListFileBacktrace Backtrace; - bool FromGenex; -}; - class cmTargetInternals; class cmTargetInternalPointer { @@ -157,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 */ @@ -293,18 +270,7 @@ public: cmTarget const* headTarget, bool usage_requirements_only) const; - /** The link implementation specifies the direct library - dependencies needed by the object files of the target. */ - struct LinkImplementationLibraries - { - // Libraries linked directly in this configuration. - std::vector<cmLinkImplItem> Libraries; - - // Libraries linked directly in other configurations. - // Needed only for OLD behavior of CMP0003. - std::vector<cmLinkItem> WrongConfigLibraries; - }; - struct LinkImplementation: public LinkImplementationLibraries + struct LinkImplementation: public cmLinkImplementationLibraries { // Languages whose runtime libraries must be linked. std::vector<std::string> Languages; @@ -312,7 +278,7 @@ public: LinkImplementation const* GetLinkImplementation(const std::string& config) const; - LinkImplementationLibraries const* + cmLinkImplementationLibraries const* GetLinkImplementationLibraries(const std::string& config) const; cmTarget const* FindTargetToLink(std::string const& name) const; @@ -631,7 +597,7 @@ private: GetImportLinkInterface(const std::string& config, cmTarget const* head, bool usage_requirements_only) const; - LinkImplementationLibraries const* + cmLinkImplementationLibraries const* GetLinkImplementationLibrariesInternal(const std::string& config, cmTarget const* head) const; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 0321f2c..2855329 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1594,7 +1594,7 @@ int cmake::ActualConfigure() } } - cmMakefile* mf=this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); + cmMakefile* mf=this->GlobalGenerator->GetMakefiles()[0]; if (mf->IsOn("CTEST_USE_LAUNCHERS") && !this->State->GetGlobalProperty("RULE_LAUNCH_COMPILE")) { |