diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-10-10 11:56:36 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-10-14 22:41:22 (GMT) |
commit | 482b3811e4e6043c71632b560f2e773289eeb320 (patch) | |
tree | 1f9f97647dfcb403bb62af639a8666d0994bce5b /Source | |
parent | 2ee1cb85e855ce0596e85ef1fc53c5c25cc1465f (diff) | |
download | CMake-482b3811e4e6043c71632b560f2e773289eeb320.zip CMake-482b3811e4e6043c71632b560f2e773289eeb320.tar.gz CMake-482b3811e4e6043c71632b560f2e773289eeb320.tar.bz2 |
cmTarget: Move link type enum out.
Remove a reason for generate time code to depend on the cmTarget header/type.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmCPluginAPI.cxx | 6 | ||||
-rw-r--r-- | Source/cmComputeLinkDepends.cxx | 16 | ||||
-rw-r--r-- | Source/cmComputeLinkDepends.h | 2 | ||||
-rw-r--r-- | Source/cmExportLibraryDependenciesCommand.cxx | 6 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 4 | ||||
-rw-r--r-- | Source/cmLinkLibrariesCommand.cxx | 4 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio6Generator.cxx | 6 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 6 | ||||
-rw-r--r-- | Source/cmMakefile.h | 4 | ||||
-rw-r--r-- | Source/cmStandardIncludes.h | 6 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 39 | ||||
-rw-r--r-- | Source/cmTarget.h | 10 | ||||
-rw-r--r-- | Source/cmTargetLinkLibrariesCommand.cxx | 26 | ||||
-rw-r--r-- | Source/cmTargetLinkLibrariesCommand.h | 2 | ||||
-rw-r--r-- | Source/cmake.cxx | 2 |
15 files changed, 72 insertions, 67 deletions
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 06eb3ec..e439182 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -373,13 +373,13 @@ void CCONV cmAddLinkLibraryForTarget(void *arg, const char *tgt, switch (libtype) { case CM_LIBRARY_GENERAL: - mf->AddLinkLibraryForTarget(tgt,value, cmTarget::GENERAL); + mf->AddLinkLibraryForTarget(tgt,value, GENERAL_LibraryType); break; case CM_LIBRARY_DEBUG: - mf->AddLinkLibraryForTarget(tgt,value, cmTarget::DEBUG); + mf->AddLinkLibraryForTarget(tgt,value, DEBUG_LibraryType); break; case CM_LIBRARY_OPTIMIZED: - mf->AddLinkLibraryForTarget(tgt,value, cmTarget::OPTIMIZED); + mf->AddLinkLibraryForTarget(tgt,value, OPTIMIZED_LibraryType); break; } } diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 22843f1..742651a 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -482,24 +482,24 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index, // Look for entries meant for this configuration. std::vector<cmLinkItem> actual_libs; - cmTarget::LinkLibraryType llt = cmTarget::GENERAL; + cmTargetLinkLibraryType llt = GENERAL_LibraryType; bool haveLLT = false; for(std::vector<std::string>::const_iterator di = deplist.begin(); di != deplist.end(); ++di) { if(*di == "debug") { - llt = cmTarget::DEBUG; + llt = DEBUG_LibraryType; haveLLT = true; } else if(*di == "optimized") { - llt = cmTarget::OPTIMIZED; + llt = OPTIMIZED_LibraryType; haveLLT = true; } else if(*di == "general") { - llt = cmTarget::GENERAL; + llt = GENERAL_LibraryType; haveLLT = true; } else if(!di->empty()) @@ -517,17 +517,17 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index, { if(strcmp(val, "debug") == 0) { - llt = cmTarget::DEBUG; + llt = DEBUG_LibraryType; } else if(strcmp(val, "optimized") == 0) { - llt = cmTarget::OPTIMIZED; + llt = OPTIMIZED_LibraryType; } } } // If the library is meant for this link type then use it. - if(llt == cmTarget::GENERAL || llt == this->LinkType) + if(llt == GENERAL_LibraryType || llt == this->LinkType) { cmLinkItem item(*di, this->FindTargetToLink(depender_index, *di)); actual_libs.push_back(item); @@ -539,7 +539,7 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index, } // Reset the link type until another explicit type is given. - llt = cmTarget::GENERAL; + llt = GENERAL_LibraryType; haveLLT = false; } } diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index d9760aa..889fb08 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -155,7 +155,7 @@ private: void CheckWrongConfigItem(cmLinkItem const& item); int ComponentOrderId; - cmTarget::LinkLibraryType LinkType; + cmTargetLinkLibraryType LinkType; bool HasConfig; bool DebugMode; bool OldLinkDirMode; diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index fde8fb1..0ef2ea5 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -120,15 +120,15 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const std::string ltValue; switch(li->second) { - case cmTarget::GENERAL: + case GENERAL_LibraryType: valueNew += "general;"; ltValue = "general"; break; - case cmTarget::DEBUG: + case DEBUG_LibraryType: valueNew += "debug;"; ltValue = "debug"; break; - case cmTarget::OPTIMIZED: + case OPTIMIZED_LibraryType: valueNew += "optimized;"; ltValue = "optimized"; break; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 1b8ad43..8c9251b 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -5416,13 +5416,13 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries( this->MaxLanguageStandards); } - cmTarget::LinkLibraryType linkType = this->Target->ComputeLinkType(config); + cmTargetLinkLibraryType linkType = this->Target->ComputeLinkType(config); cmTarget::LinkLibraryVectorType const& oldllibs = this->Target->GetOriginalLinkLibraries(); for(cmTarget::LinkLibraryVectorType::const_iterator li = oldllibs.begin(); li != oldllibs.end(); ++li) { - if(li->second != cmTarget::GENERAL && li->second != linkType) + if(li->second != GENERAL_LibraryType && li->second != linkType) { std::string name = this->Target->CheckCMP0004(li->first); if(name == this->GetName() || name.empty()) diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx index 996b538..eb3bfce 100644 --- a/Source/cmLinkLibrariesCommand.cxx +++ b/Source/cmLinkLibrariesCommand.cxx @@ -34,7 +34,7 @@ bool cmLinkLibrariesCommand return false; } this->Makefile->AddLinkLibrary(*i, - cmTarget::DEBUG); + DEBUG_LibraryType); } else if (*i == "optimized") { @@ -46,7 +46,7 @@ bool cmLinkLibrariesCommand return false; } this->Makefile->AddLinkLibrary(*i, - cmTarget::OPTIMIZED); + OPTIMIZED_LibraryType); } else { diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 6ecd9a8..c620baf 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1145,7 +1145,7 @@ void cmLocalVisualStudio6Generator libDebug = this->ConvertToOutputFormat(libDebug.c_str(), SHELL); - if (j->second == cmTarget::GENERAL) + if (j->second == GENERAL_LibraryType) { libOptions += " "; libOptions += lib; @@ -1156,7 +1156,7 @@ void cmLocalVisualStudio6Generator libMultiLineOptionsForDebug += libDebug; libMultiLineOptionsForDebug += "\n"; } - if (j->second == cmTarget::DEBUG) + if (j->second == DEBUG_LibraryType) { libDebugOptions += " "; libDebugOptions += lib; @@ -1165,7 +1165,7 @@ void cmLocalVisualStudio6Generator libMultiLineDebugOptions += libDebug; libMultiLineDebugOptions += "\n"; } - if (j->second == cmTarget::OPTIMIZED) + if (j->second == OPTIMIZED_LibraryType) { libOptimizedOptions += " "; libOptimizedOptions += lib; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 045cca8..d62c5c4 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1400,7 +1400,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) } void cmMakefile::AddLinkLibrary(const std::string& lib, - cmTarget::LinkLibraryType llt) + cmTargetLinkLibraryType llt) { cmTarget::LibraryID tmp; tmp.first = lib; @@ -1410,7 +1410,7 @@ void cmMakefile::AddLinkLibrary(const std::string& lib, void cmMakefile::AddLinkLibraryForTarget(const std::string& target, const std::string& lib, - cmTarget::LinkLibraryType llt) + cmTargetLinkLibraryType llt) { cmTargets::iterator i = this->Targets.find(target); if ( i != this->Targets.end()) @@ -1471,7 +1471,7 @@ void cmMakefile::AddLinkDirectoryForTarget(const std::string& target, void cmMakefile::AddLinkLibrary(const std::string& lib) { - this->AddLinkLibrary(lib,cmTarget::GENERAL); + this->AddLinkLibrary(lib,GENERAL_LibraryType); } void cmMakefile::InitializeFromParent(cmMakefile* parent) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 99ed73d..d9d5a8a 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -219,9 +219,9 @@ public: * Add a link library to the build. */ void AddLinkLibrary(const std::string&); - void AddLinkLibrary(const std::string&, cmTarget::LinkLibraryType type); + void AddLinkLibrary(const std::string&, cmTargetLinkLibraryType type); void AddLinkLibraryForTarget(const std::string& tgt, const std::string&, - cmTarget::LinkLibraryType type); + cmTargetLinkLibraryType type); void AddLinkDirectoryForTarget(const std::string& tgt, const std::string& d); /** diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 468a589..dd8fa9c 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -123,4 +123,10 @@ static thisClass* SafeDownCast(cmObject *c) \ } \ class cmTypeMacro_UseTrailingSemicolon +enum cmTargetLinkLibraryType { + GENERAL_LibraryType, + DEBUG_LibraryType, + OPTIMIZED_LibraryType +}; + #endif diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 847a5c1..0128c78 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -632,13 +632,13 @@ const std::vector<std::string>& cmTarget::GetLinkDirectories() const } //---------------------------------------------------------------------------- -cmTarget::LinkLibraryType cmTarget::ComputeLinkType( +cmTargetLinkLibraryType cmTarget::ComputeLinkType( const std::string& config) const { // No configuration is always optimized. if(config.empty()) { - return cmTarget::OPTIMIZED; + return OPTIMIZED_LibraryType; } // Get the list of configurations considered to be DEBUG. @@ -650,10 +650,10 @@ cmTarget::LinkLibraryType cmTarget::ComputeLinkType( if (std::find(debugConfigs.begin(), debugConfigs.end(), configUpper) != debugConfigs.end()) { - return cmTarget::DEBUG; + return DEBUG_LibraryType; } // The current configuration is not a debug configuration. - return cmTarget::OPTIMIZED; + return OPTIMIZED_LibraryType; } //---------------------------------------------------------------------------- @@ -693,9 +693,9 @@ bool cmTarget::NameResolvesToFramework(const std::string& libname) const //---------------------------------------------------------------------------- std::string cmTarget::GetDebugGeneratorExpressions(const std::string &value, - cmTarget::LinkLibraryType llt) const + cmTargetLinkLibraryType llt) const { - if (llt == GENERAL) + if (llt == GENERAL_LibraryType) { return value; } @@ -716,7 +716,7 @@ std::string cmTarget::GetDebugGeneratorExpressions(const std::string &value, configString = "$<OR:" + configString + ">"; } - if (llt == OPTIMIZED) + if (llt == OPTIMIZED_LibraryType) { configString = "$<NOT:" + configString + ">"; } @@ -773,15 +773,16 @@ void cmTarget::GetTllSignatureTraces(std::ostringstream &s, void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& target, const std::string& lib, - LinkLibraryType llt) + cmTargetLinkLibraryType llt) { cmTarget *tgt = this->Makefile->FindTargetToUse(lib); { const bool isNonImportedTarget = tgt && !tgt->IsImported(); - const std::string libName = (isNonImportedTarget && llt != GENERAL) - ? targetNameGenex(lib) - : lib; + const std::string libName = + (isNonImportedTarget && llt != GENERAL_LibraryType) + ? targetNameGenex(lib) + : lib; this->AppendProperty("LINK_LIBRARIES", this->GetDebugGeneratorExpressions(libName, llt).c_str()); @@ -822,13 +823,13 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, } switch (llt) { - case cmTarget::GENERAL: + case GENERAL_LibraryType: dependencies += "general"; break; - case cmTarget::DEBUG: + case DEBUG_LibraryType: dependencies += "debug"; break; - case cmTarget::OPTIMIZED: + case OPTIMIZED_LibraryType: dependencies += "optimized"; break; } @@ -1162,7 +1163,7 @@ void cmTarget::GatherDependenciesForVS6( const cmMakefile& mf, // Parse the dependency information, which is a set of // type, library pairs separated by ";". There is always a trailing ";". - cmTarget::LinkLibraryType llt = cmTarget::GENERAL; + cmTargetLinkLibraryType llt = GENERAL_LibraryType; std::string depline = deps; std::string::size_type start = 0; std::string::size_type end; @@ -1174,22 +1175,22 @@ void cmTarget::GatherDependenciesForVS6( const cmMakefile& mf, { if (l == "debug") { - llt = cmTarget::DEBUG; + llt = DEBUG_LibraryType; } else if (l == "optimized") { - llt = cmTarget::OPTIMIZED; + llt = OPTIMIZED_LibraryType; } else if (l == "general") { - llt = cmTarget::GENERAL; + llt = GENERAL_LibraryType; } else { LibraryID lib2(l,llt); this->InsertDependencyForVS6( dep_map, lib, lib2); this->GatherDependenciesForVS6( mf, lib2, dep_map); - llt = cmTarget::GENERAL; + llt = GENERAL_LibraryType; } } start = end+1; // skip the ; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 97515a7..b0d5f4a 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -140,17 +140,15 @@ public: cmSourceFile* AddSourceCMP0049(const std::string& src); cmSourceFile* AddSource(const std::string& src); - enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED}; - //* how we identify a library, by name and type - typedef std::pair<std::string, LinkLibraryType> LibraryID; + typedef std::pair<std::string, cmTargetLinkLibraryType> LibraryID; typedef std::vector<LibraryID > LinkLibraryVectorType; const LinkLibraryVectorType &GetOriginalLinkLibraries() const {return this->OriginalLinkLibraries;} /** Compute the link type to use for the given configuration. */ - LinkLibraryType ComputeLinkType(const std::string& config) const; + cmTargetLinkLibraryType ComputeLinkType(const std::string& config) const; /** * Clear the dependency information recorded for this target, if any. @@ -161,7 +159,7 @@ public: bool NameResolvesToFramework(const std::string& libname) const; void AddLinkLibrary(cmMakefile& mf, const std::string& target, const std::string& lib, - LinkLibraryType llt); + cmTargetLinkLibraryType llt); enum TLLSignature { KeywordTLLSignature, PlainTLLSignature @@ -297,7 +295,7 @@ public: void AppendBuildInterfaceIncludes(); std::string GetDebugGeneratorExpressions(const std::string &value, - cmTarget::LinkLibraryType llt) const; + cmTargetLinkLibraryType llt) const; void AddSystemIncludeDirectories(const std::set<std::string> &incs); std::set<std::string> const & GetSystemIncludeDirectories() const diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index b57b921..1a1cf39 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -136,7 +136,7 @@ bool cmTargetLinkLibrariesCommand } // Keep track of link configuration specifiers. - cmTarget::LinkLibraryType llt = cmTarget::GENERAL; + cmTargetLinkLibraryType llt = GENERAL_LibraryType; bool haveLLT = false; // Start with primary linking and switch to link interface @@ -242,27 +242,27 @@ bool cmTargetLinkLibrariesCommand { if(haveLLT) { - this->LinkLibraryTypeSpecifierWarning(llt, cmTarget::DEBUG); + this->LinkLibraryTypeSpecifierWarning(llt, DEBUG_LibraryType); } - llt = cmTarget::DEBUG; + llt = DEBUG_LibraryType; haveLLT = true; } else if(args[i] == "optimized") { if(haveLLT) { - this->LinkLibraryTypeSpecifierWarning(llt, cmTarget::OPTIMIZED); + this->LinkLibraryTypeSpecifierWarning(llt, OPTIMIZED_LibraryType); } - llt = cmTarget::OPTIMIZED; + llt = OPTIMIZED_LibraryType; haveLLT = true; } else if(args[i] == "general") { if(haveLLT) { - this->LinkLibraryTypeSpecifierWarning(llt, cmTarget::GENERAL); + this->LinkLibraryTypeSpecifierWarning(llt, GENERAL_LibraryType); } - llt = cmTarget::GENERAL; + llt = GENERAL_LibraryType; haveLLT = true; } else if(haveLLT) @@ -282,7 +282,7 @@ bool cmTargetLinkLibrariesCommand // specifed that a library is both debug and optimized. (this check is // only there for backwards compatibility when mixing projects built // with old versions of CMake and new) - llt = cmTarget::GENERAL; + llt = GENERAL_LibraryType; std::string linkType = args[0]; linkType += "_LINK_TYPE"; const char* linkTypeString = @@ -291,11 +291,11 @@ bool cmTargetLinkLibrariesCommand { if(strcmp(linkTypeString, "debug") == 0) { - llt = cmTarget::DEBUG; + llt = DEBUG_LibraryType; } if(strcmp(linkTypeString, "optimized") == 0) { - llt = cmTarget::OPTIMIZED; + llt = OPTIMIZED_LibraryType; } } if (!this->HandleLibrary(args[i], llt)) @@ -350,7 +350,7 @@ cmTargetLinkLibrariesCommand //---------------------------------------------------------------------------- bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, - cmTarget::LinkLibraryType llt) + cmTargetLinkLibraryType llt) { if(this->Target->GetType() == cmTarget::INTERFACE_LIBRARY && this->CurrentProcessingState != ProcessingKeywordLinkInterface) @@ -469,7 +469,7 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, std::string prop; // Include this library in the link interface for the target. - if(llt == cmTarget::DEBUG || llt == cmTarget::GENERAL) + if(llt == DEBUG_LibraryType || llt == GENERAL_LibraryType) { // Put in the DEBUG configuration interfaces. for(std::vector<std::string>::const_iterator i = debugConfigs.begin(); @@ -480,7 +480,7 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, this->Target->AppendProperty(prop, lib.c_str()); } } - if(llt == cmTarget::OPTIMIZED || llt == cmTarget::GENERAL) + if(llt == OPTIMIZED_LibraryType || llt == GENERAL_LibraryType) { // Put in the non-DEBUG configuration interfaces. this->Target->AppendProperty("LINK_INTERFACE_LIBRARIES", lib.c_str()); diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index 47dd8bd..f061e6d 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.h @@ -62,7 +62,7 @@ private: ProcessingState CurrentProcessingState; - bool HandleLibrary(const std::string& lib, cmTarget::LinkLibraryType llt); + bool HandleLibrary(const std::string& lib, cmTargetLinkLibraryType llt); }; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 7d499de..7268241 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -477,7 +477,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args) ++libIt) { mf->AddLinkLibraryForTarget(targetName, *libIt, - cmTarget::GENERAL); + GENERAL_LibraryType); } |