diff options
author | Ken Martin <ken.martin@kitware.com> | 2007-03-12 14:26:59 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2007-03-12 14:26:59 (GMT) |
commit | b99129d2d81a494055d40443e8e044c9db4ca807 (patch) | |
tree | 07cbf0e96e3cb1480e182f5bbbf860d2224beade | |
parent | cf7eeab37aa644a0a09cb40e8958d99e8d771857 (diff) | |
download | CMake-b99129d2d81a494055d40443e8e044c9db4ca807.zip CMake-b99129d2d81a494055d40443e8e044c9db4ca807.tar.gz CMake-b99129d2d81a494055d40443e8e044c9db4ca807.tar.bz2 |
ENH: some code cleanup
-rw-r--r-- | Source/cmAddExecutableCommand.cxx | 6 | ||||
-rw-r--r-- | Source/cmAddLibraryCommand.cxx | 6 | ||||
-rw-r--r-- | Source/cmAddSubDirectoryCommand.cxx | 6 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator3.cxx | 10 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio6Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio71Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio7Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmIncludeExternalMSProjectCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmInstallFilesCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmInstallProgramsCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 12 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 21 | ||||
-rw-r--r-- | Source/cmMakefile.h | 8 | ||||
-rw-r--r-- | Source/cmSubdirCommand.cxx | 8 | ||||
-rw-r--r-- | Source/cmTarget.h | 8 |
17 files changed, 44 insertions, 63 deletions
diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index e04c124..e791a82 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -31,7 +31,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args) ++s; bool use_win32 = false; bool use_macbundle = false; - bool in_all = true; + bool excludeFromAll = false; while ( s != args.end() ) { if (*s == "WIN32") @@ -47,7 +47,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args) else if(*s == "EXCLUDE_FROM_ALL") { ++s; - in_all = false; + excludeFromAll = true; } else { @@ -64,7 +64,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args) std::vector<std::string> srclists(s, args.end()); cmTarget* tgt = this->Makefile->AddExecutable(exename.c_str(), srclists, - in_all); + excludeFromAll); if ( use_win32 ) { tgt->SetProperty("WIN32_EXECUTABLE", "ON"); diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index 6084e3a..09e3774 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -28,7 +28,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args) // otherwise it defaults to static library. int shared = !cmSystemTools::IsOff(this->Makefile->GetDefinition("BUILD_SHARED_LIBS")); - bool in_all = true; + bool excludeFromAll = false; std::vector<std::string>::const_iterator s = args.begin(); @@ -60,7 +60,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args) else if(*s == "EXCLUDE_FROM_ALL") { ++s; - in_all = false; + excludeFromAll = true; } else { @@ -85,7 +85,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args) } this->Makefile->AddLibrary(this->LibName.c_str(), shared, srclists, - in_all); + excludeFromAll); return true; } diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx index 06ac648..72f5c51 100644 --- a/Source/cmAddSubDirectoryCommand.cxx +++ b/Source/cmAddSubDirectoryCommand.cxx @@ -30,7 +30,7 @@ bool cmAddSubDirectoryCommand::InitialPass std::string srcArg = args[0]; std::string binArg; - bool intoplevel = true; + bool excludeFromAll = false; // process the rest of the arguments looking for optional args std::vector<std::string>::const_iterator i = args.begin(); @@ -39,7 +39,7 @@ bool cmAddSubDirectoryCommand::InitialPass { if(*i == "EXCLUDE_FROM_ALL") { - intoplevel = false; + excludeFromAll = true; continue; } else if (!binArg.size()) @@ -122,7 +122,7 @@ bool cmAddSubDirectoryCommand::InitialPass // Add the subdirectory using the computed full paths. this->Makefile->AddSubDirectory(srcPath.c_str(), binPath.c_str(), - intoplevel, false, true); + excludeFromAll, false, true); return true; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 36d6fba..2b58f8b 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1006,13 +1006,13 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, cmLocalGenerator* cur = gen->GetParent(); while(cur && cur != root) { - if(cur->GetExcludeAll()) + if(cur->GetMakefile()->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { return true; } cur = cur->GetParent(); } - return gen->GetExcludeAll(); + return gen->GetMakefile()->GetPropertyAsBool("EXCLUDE_FROM_ALL"); } @@ -1359,7 +1359,7 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget( cmTarget target; target.GetProperties().SetCMakeInstance(this->CMakeInstance); target.SetType(cmTarget::GLOBAL_TARGET, name); - target.SetInAll(false); + target.SetProperty("EXCLUDE_FROM_ALL","TRUE"); std::vector<std::string> no_outputs; std::vector<std::string> no_depends; diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index c702742..c8fbc8f 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -229,7 +229,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2() cmLocalGenerator *lg3 = lg; while (lg3) { - if (lg3->GetExcludeAll()) + if (lg3->GetMakefile()->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { exclude = true; break; @@ -478,7 +478,7 @@ cmGlobalUnixMakefileGenerator3 (l->second.GetType() == cmTarget::UTILITY)) { // Add this to the list of depends rules in this directory. - if((!check_all || l->second.IsInAll()) && + if((!check_all || !l->second.GetPropertyAsBool("EXCLUDE_FROM_ALL")) && (!check_relink || l->second.NeedRelinkBeforeInstall())) { std::string tname = lg->GetRelativeTargetDirectory(l->second); @@ -790,7 +790,7 @@ cmGlobalUnixMakefileGenerator3 localName.c_str(), depends, commands, true); // add the all/all dependency - if (!exclude && t->second.IsInAll()) + if (!exclude && !t->second.GetPropertyAsBool("EXCLUDE_FROM_ALL")) { depends.clear(); depends.push_back(localName); @@ -937,7 +937,7 @@ GetNumberOfProgressActionsInAll(cmLocalUnixMakefileGenerator3 *lg) (t->second.GetType() == cmTarget::MODULE_LIBRARY) || (t->second.GetType() == cmTarget::UTILITY)) { - if (t->second.IsInAll()) + if (!t->second.GetPropertyAsBool("EXCLUDE_FROM_ALL")) { std::vector<int> &progFiles = lg3->ProgressFiles[t->first]; result += static_cast<unsigned long>(progFiles.size()); @@ -966,7 +966,7 @@ GetNumberOfProgressActionsInAll(cmLocalUnixMakefileGenerator3 *lg) (l->second.GetType() == cmTarget::UTILITY)) { // Add this to the list of depends rules in this directory. - if (l->second.IsInAll() && + if (!l->second.GetPropertyAsBool("EXCLUDE_FROM_ALL") && targets.find(&l->second) == targets.end()) { std::deque<cmTarget *> activeTgts; diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 850a8c5..e520a17 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -247,7 +247,7 @@ void cmGlobalVisualStudio6Generator for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al) { - if (al->second.IsInAll()) + if (!al->second.GetPropertyAsBool("EXCLUDE_FROM_ALL")) { if (al->second.GetType() == cmTarget::UTILITY || al->second.GetType() == cmTarget::GLOBAL_TARGET) diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index acb62af..bc02e16 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -109,7 +109,7 @@ void cmGlobalVisualStudio71Generator for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al) { - if (al->second.IsInAll()) + if (!al->second.GetPropertyAsBool("EXCLUDE_FROM_ALL")) { if (al->second.GetType() == cmTarget::UTILITY || al->second.GetType() == cmTarget::GLOBAL_TARGET) diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 0edb056..701137f 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -339,7 +339,7 @@ void cmGlobalVisualStudio7Generator for(cmTargets::iterator al = atgts.begin(); al != atgts.end(); ++al) { - if (al->second.IsInAll()) + if (!al->second.GetPropertyAsBool("EXCLUDE_FROM_ALL")) { if (al->second.GetType() == cmTarget::UTILITY || al->second.GetType() == cmTarget::GLOBAL_TARGET) diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx index f00d9c3..d4a74ba 100644 --- a/Source/cmIncludeExternalMSProjectCommand.cxx +++ b/Source/cmIncludeExternalMSProjectCommand.cxx @@ -52,7 +52,7 @@ bool cmIncludeExternalMSProjectCommand // Create a target instance for this utility. cmTarget target; target.SetType(cmTarget::UTILITY, utility_name.c_str()); - target.SetInAll(true); + target.SetProperty("EXCLUDE_FROM_ALL","FALSE"); target.SetMakefile(this->Makefile); std::vector<std::string> no_outputs; cmCustomCommandLines commandLines; diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 2809e2e..33c0899 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -38,7 +38,7 @@ bool cmInstallFilesCommand cmTarget& target = this->Makefile->GetTargets()[this->TargetName]; target.SetType(cmTarget::INSTALL_FILES, this->TargetName.c_str()); target.SetMakefile(this->Makefile); - target.SetInAll(false); + target.SetProperty("EXCLUDE_FROM_ALL","TRUE"); target.SetInstallPath(args[0].c_str()); if((args.size() > 1) && (args[1] == "FILES")) diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index b04b1e1..0b320a4 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -35,7 +35,7 @@ bool cmInstallProgramsCommand cmTarget& target = this->Makefile->GetTargets()[this->TargetName]; target.SetType(cmTarget::INSTALL_PROGRAMS, this->TargetName.c_str()); target.SetMakefile(this->Makefile); - target.SetInAll(false); + target.SetProperty("EXCLUDE_FROM_ALL","TRUE"); target.SetInstallPath(args[0].c_str()); std::vector<std::string>::const_iterator s = args.begin(); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 33753c7..1d5df5d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -409,7 +409,7 @@ void cmLocalGenerator::GenerateInstallRules() for(std::vector<cmLocalGenerator*>::const_iterator ci = this->Children.begin(); ci != this->Children.end(); ++ci) { - if(!(*ci)->GetExcludeAll()) + if(!(*ci)->GetMakefile()->GetProperty("EXCLUDE_FROM_ALL")) { std::string odir = (*ci)->GetMakefile()->GetStartOutputDirectory(); cmSystemTools::ConvertToUnixSlashes(odir); @@ -2610,13 +2610,3 @@ std::string cmLocalGenerator::GetSourceObjectName(cmSourceFile& sf) { return sf.GetSourceName(); } - -bool cmLocalGenerator::GetExcludeAll() -{ - return this->Makefile->GetPropertyAsBool("EXCLUDE_FROM_ALL"); -} - -void cmLocalGenerator::SetExcludeAll(bool b) -{ - this->Makefile->SetProperty("EXCLUDE_FROM_ALL", b?"TRUE":"FALSE"); -} diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 4690da5..b0d0610 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -110,10 +110,6 @@ public: */ std::string ConvertToOptionallyRelativeOutputPath(const char* remote); - // flag to determine if this project should be included in a parent project - bool GetExcludeAll(); - void SetExcludeAll(bool b); - ///! set/get the parent generator cmLocalGenerator* GetParent(){return this->Parent;} void SetParent(cmLocalGenerator* g) { this->Parent = g; g->AddChild(this); } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index cce03b1..6e262bc 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -818,7 +818,7 @@ void cmMakefile::AddUtilityCommand(const char* utilityName, bool all, cmTarget target; target.SetMakefile(this); target.SetType(cmTarget::UTILITY, utilityName); - target.SetInAll(all); + target.SetProperty("EXCLUDE_FROM_ALL", (all) ?"FALSE" : "TRUE"); if(!comment) { @@ -1066,7 +1066,7 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) } void cmMakefile::AddSubDirectory(const char* sub, - bool topLevel, bool preorder) + bool excludeFromAll, bool preorder) { // the source path must be made full if it isn't already std::string srcPath = sub; @@ -1088,12 +1088,12 @@ void cmMakefile::AddSubDirectory(const char* sub, this->AddSubDirectory(srcPath.c_str(), binPath.c_str(), - topLevel, preorder, false); + excludeFromAll, preorder, false); } void cmMakefile::AddSubDirectory(const char* srcPath, const char *binPath, - bool topLevel, bool preorder, + bool excludeFromAll, bool preorder, bool immediate) { std::vector<cmLocalGenerator *>& children = @@ -1120,7 +1120,8 @@ void cmMakefile::AddSubDirectory(const char* srcPath, const char *binPath, // set the subdirs start dirs lg2->GetMakefile()->SetStartDirectory(srcPath); lg2->GetMakefile()->SetStartOutputDirectory(binPath); - lg2->SetExcludeAll(!topLevel); + lg2->GetMakefile()->SetProperty("EXCLUDE_FROM_ALL", + (excludeFromAll) ? "TRUE" : "FALSE"); lg2->GetMakefile()->SetPreOrder(preorder); if (immediate) @@ -1318,7 +1319,7 @@ void cmMakefile::AddGlobalLinkInformation(const char* name, cmTarget& target) void cmMakefile::AddLibrary(const char* lname, int shared, const std::vector<std::string> &srcs, - bool in_all) + bool excludeFromAll) { cmTarget target; switch (shared) @@ -1341,7 +1342,8 @@ void cmMakefile::AddLibrary(const char* lname, int shared, // over changes in CMakeLists.txt, making the information stale and // hence useless. target.ClearDependencyInformation( *this, lname ); - target.SetInAll(in_all); + target.SetProperty("EXCLUDE_FROM_ALL", + (excludeFromAll) ? "TRUE" : "FALSE"); target.GetSourceLists() = srcs; this->AddGlobalLinkInformation(lname, target); cmTargets::iterator it = @@ -1351,12 +1353,13 @@ void cmMakefile::AddLibrary(const char* lname, int shared, cmTarget* cmMakefile::AddExecutable(const char *exeName, const std::vector<std::string> &srcs, - bool in_all) + bool excludeFromAll) { cmTarget target; target.SetType(cmTarget::EXECUTABLE, exeName); target.SetMakefile(this); - target.SetInAll(in_all); + target.SetProperty("EXCLUDE_FROM_ALL", + (excludeFromAll) ?"TRUE" : "FALSE"); target.GetSourceLists() = srcs; this->AddGlobalLinkInformation(exeName, target); cmTargets::iterator it = diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index cc4d3c9..606ddee 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -170,7 +170,7 @@ public: */ cmTarget* AddExecutable(const char *exename, const std::vector<std::string> &srcs, - bool in_all = true); + bool excludeFromAll = false); /** * Add a utility to the build. A utiltity target is a command that @@ -224,10 +224,10 @@ public: /** * Add a subdirectory to the build. */ - void AddSubDirectory(const char*, bool includeTopLevel=true, + void AddSubDirectory(const char*, bool excludeFromAll=false, bool preorder = false); void AddSubDirectory(const char* fullSrcDir,const char *fullBinDir, - bool includeTopLevel, bool preorder, + bool excludeFromAll, bool preorder, bool immediate); /** @@ -281,7 +281,7 @@ public: */ void AddLibrary(const char *libname, int shared, const std::vector<std::string> &srcs, - bool in_all = true); + bool excludeFromAll = false); #if defined(CMAKE_BUILD_WITH_CMAKE) /** diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx index 207dfec..48b558d 100644 --- a/Source/cmSubdirCommand.cxx +++ b/Source/cmSubdirCommand.cxx @@ -25,7 +25,7 @@ bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args) return false; } bool res = true; - bool intoplevel = true; + bool excludeFromAll = false; bool preorder = false; for(std::vector<std::string>::const_iterator i = args.begin(); @@ -33,7 +33,7 @@ bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args) { if(*i == "EXCLUDE_FROM_ALL") { - intoplevel = false; + excludeFromAll = true; continue; } if(*i == "PREORDER") @@ -52,7 +52,7 @@ bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args) std::string(this->Makefile->GetCurrentOutputDirectory()) + "/" + i->c_str(); this->Makefile->AddSubDirectory(srcPath.c_str(), binPath.c_str(), - intoplevel, preorder, false); + excludeFromAll, preorder, false); } // otherwise it is a full path else if ( cmSystemTools::FileIsDirectory(i->c_str()) ) @@ -63,7 +63,7 @@ bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args) std::string(this->Makefile->GetCurrentOutputDirectory()) + "/" + cmSystemTools::GetFilenameName(i->c_str()); this->Makefile->AddSubDirectory(i->c_str(), binPath.c_str(), - intoplevel, preorder, false); + excludeFromAll, preorder, false); } else { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 665c97b..6e446e0 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -57,14 +57,6 @@ public: ///! Set/Get the name of the target const char* GetName() {return this->Name.c_str();} - /** - * Indicate whether the target is part of the all target - */ - bool IsInAll() { return !this->GetPropertyAsBool("EXCLUDE_FROM_ALL"); } - bool GetInAll() { return !this->GetPropertyAsBool("EXCLUDE_FROM_ALL"); } - void SetInAll(bool f) { - this->SetProperty("EXCLUDE_FROM_ALL", (f) ?"FALSE" : "TRUE"); } - ///! Set the cmMakefile that owns this target void SetMakefile(cmMakefile *mf); cmMakefile *GetMakefile() { return this->Makefile;}; |