diff options
author | Brad King <brad.king@kitware.com> | 2014-03-09 14:29:02 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-03-09 14:29:02 (GMT) |
commit | ad9f0d831e6522d9606bab7ae08559cebeed83ce (patch) | |
tree | d85ba309d378fac37063e7b05fc624e60a819a64 /Source/cmMakefileLibraryTargetGenerator.cxx | |
parent | 6aad93f407f341fae1afb80ebeab532451c39458 (diff) | |
parent | b633b263082ae2c74a030aefb9048b0a20098b61 (diff) | |
download | CMake-ad9f0d831e6522d9606bab7ae08559cebeed83ce.zip CMake-ad9f0d831e6522d9606bab7ae08559cebeed83ce.tar.gz CMake-ad9f0d831e6522d9606bab7ae08559cebeed83ce.tar.bz2 |
Merge topic 'dev/string-apis'
b633b263 CPackWiX: Fix test to build with expected config
191f25e2 stringapi: Prevent a NULL dereference in WiX
219d6ad6 speedup: Avoid excess iterator dereferences
caaad357 speedup: Cache strings for comparisons
7abf4e31 stringapi: Use strings for dependency information
94fc63e2 stringapi: Use strings for cache iterator values
85fc9f26 stringapi: Command names
6557382d stringapi: Use strings for program paths
1a1b737c stringapi: Use strings for generator names
24b5e93d stringapi: Use strings for directories
11ed3e2c stringapi: Add string overload for the Def struct
b3bf31a5 stringapi: Miscellaneous char* parameters
5af95c39 typo: Match argument name with the header
2b17626e stringapi: Pass strings as install directories in CPack
3def29da stringapi: Use strings for feature arguments
acb116e3 stringapi: Return a string reference for the configuration
...
Diffstat (limited to 'Source/cmMakefileLibraryTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 39e00b2..d9425e6 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -125,19 +125,16 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules() depends, commands, true); // Write the main driver rule to build everything in this target. - this->WriteTargetDriverRule(this->Target->GetName(), false); + this->WriteTargetDriverRule(this->Target->GetName().c_str(), false); } //---------------------------------------------------------------------------- void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() { - const char* linkLanguage = + std::string linkLanguage = this->Target->GetLinkerLanguage(this->ConfigName); std::string linkRuleVar = "CMAKE_"; - if (linkLanguage) - { - linkRuleVar += linkLanguage; - } + linkRuleVar += linkLanguage; linkRuleVar += "_CREATE_STATIC_LIBRARY"; if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION") && @@ -160,13 +157,10 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) this->WriteFrameworkRules(relink); return; } - const char* linkLanguage = + std::string linkLanguage = this->Target->GetLinkerLanguage(this->ConfigName); std::string linkRuleVar = "CMAKE_"; - if (linkLanguage) - { - linkRuleVar += linkLanguage; - } + linkRuleVar += linkLanguage; linkRuleVar += "_CREATE_SHARED_LIBRARY"; std::string extraFlags; @@ -187,13 +181,10 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) //---------------------------------------------------------------------------- void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) { - const char* linkLanguage = + std::string linkLanguage = this->Target->GetLinkerLanguage(this->ConfigName); std::string linkRuleVar = "CMAKE_"; - if (linkLanguage) - { - linkRuleVar += linkLanguage; - } + linkRuleVar += linkLanguage; linkRuleVar += "_CREATE_SHARED_MODULE"; std::string extraFlags; @@ -213,13 +204,10 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) //---------------------------------------------------------------------------- void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink) { - const char* linkLanguage = + std::string linkLanguage = this->Target->GetLinkerLanguage(this->ConfigName); std::string linkRuleVar = "CMAKE_"; - if (linkLanguage) - { - linkRuleVar += linkLanguage; - } + linkRuleVar += linkLanguage; linkRuleVar += "_CREATE_MACOSX_FRAMEWORK"; std::string extraFlags; @@ -237,7 +225,7 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink) //---------------------------------------------------------------------------- void cmMakefileLibraryTargetGenerator::WriteLibraryRules -(const char* linkRuleVar, const char* extraFlags, bool relink) +(const std::string& linkRuleVar, const std::string& extraFlags, bool relink) { // TODO: Merge the methods that call this method to avoid // code duplication. @@ -248,20 +236,20 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules this->AppendLinkDepends(depends); // Get the language to use for linking this library. - const char* linkLanguage = + std::string linkLanguage = this->Target->GetLinkerLanguage(this->ConfigName); // Make sure we have a link language. - if(!linkLanguage) + if(linkLanguage.empty()) { cmSystemTools::Error("Cannot determine link language for target \"", - this->Target->GetName(), "\"."); + this->Target->GetName().c_str(), "\"."); return; } // Create set of linking flags. std::string linkFlags; - this->LocalGenerator->AppendFlags(linkFlags, extraFlags); + this->LocalGenerator->AppendFlags(linkFlags, extraFlags.c_str()); // Add OSX version flags, if any. if(this->Target->GetType() == cmTarget::SHARED_LIBRARY || @@ -589,7 +577,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules vars.RuleLauncher = "RULE_LAUNCH_LINK"; vars.CMTarget = this->Target; - vars.Language = linkLanguage; + vars.Language = linkLanguage.c_str(); vars.Objects = buildObjs.c_str(); std::string objectDir = this->Target->GetSupportDirectory(); objectDir = this->Convert(objectDir.c_str(), @@ -786,7 +774,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules //---------------------------------------------------------------------------- void cmMakefileLibraryTargetGenerator -::AppendOSXVerFlag(std::string& flags, const char* lang, +::AppendOSXVerFlag(std::string& flags, const std::string& lang, const char* name, bool so) { // Lookup the flag to specify the version. |