diff options
Diffstat (limited to 'Source/cmMakefileLibraryTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 68 |
1 files changed, 21 insertions, 47 deletions
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index c538992..2d2915c 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -137,10 +137,7 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() this->GeneratorTarget->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS"); if (hasCUDA && resolveDeviceSymbols) { std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY"; - std::string extraFlags; - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - this->WriteDeviceLibraryRules(linkRuleVar, extraFlags, false); + this->WriteDeviceLibraryRules(linkRuleVar, false); } std::string linkLanguage = @@ -151,7 +148,7 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() std::string extraFlags; this->LocalGenerator->GetStaticLibraryFlags( - extraFlags, cmSystemTools::UpperCase(this->ConfigName), + extraFlags, cmSystemTools::UpperCase(this->ConfigName), linkLanguage, this->GeneratorTarget); this->WriteLibraryRules(linkRuleVar, extraFlags, false); } @@ -173,10 +170,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) cuda_lang) != closure->Languages.end()); if (hasCUDA) { std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY"; - std::string extraFlags; - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - this->WriteDeviceLibraryRules(linkRuleVar, extraFlags, relink); + this->WriteDeviceLibraryRules(linkRuleVar, relink); } } @@ -187,13 +181,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) linkRuleVar += "_CREATE_SHARED_LIBRARY"; std::string extraFlags; - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - std::string linkFlagsConfig = "LINK_FLAGS_"; - linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig)); - + this->GetTargetLinkFlags(extraFlags, linkLanguage); this->LocalGenerator->AddConfigVariableFlags( extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->ConfigName); @@ -223,10 +211,7 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) cuda_lang) != closure->Languages.end()); if (hasCUDA) { std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY"; - std::string extraFlags; - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - this->WriteDeviceLibraryRules(linkRuleVar, extraFlags, relink); + this->WriteDeviceLibraryRules(linkRuleVar, relink); } } @@ -237,12 +222,7 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) linkRuleVar += "_CREATE_SHARED_MODULE"; std::string extraFlags; - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - std::string linkFlagsConfig = "LINK_FLAGS_"; - linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig)); + this->GetTargetLinkFlags(extraFlags, linkLanguage); this->LocalGenerator->AddConfigVariableFlags( extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->ConfigName); @@ -265,12 +245,7 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink) linkRuleVar += "_CREATE_MACOSX_FRAMEWORK"; std::string extraFlags; - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - std::string linkFlagsConfig = "LINK_FLAGS_"; - linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig)); + this->GetTargetLinkFlags(extraFlags, linkLanguage); this->LocalGenerator->AddConfigVariableFlags( extraFlags, "CMAKE_MACOSX_FRAMEWORK_LINKER_FLAGS", this->ConfigName); @@ -278,25 +253,25 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink) } void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules( - const std::string& linkRuleVar, const std::string& extraFlags, bool relink) + const std::string& linkRuleVar, bool relink) { #ifdef CMAKE_BUILD_WITH_CMAKE // TODO: Merge the methods that call this method to avoid // code duplication. std::vector<std::string> commands; - // Build list of dependencies. - std::vector<std::string> depends; - this->AppendLinkDepends(depends); - // Get the language to use for linking this library. std::string linkLanguage = "CUDA"; std::string const objExt = this->Makefile->GetSafeDefinition("CMAKE_CUDA_OUTPUT_EXTENSION"); + // Build list of dependencies. + std::vector<std::string> depends; + this->AppendLinkDepends(depends, linkLanguage); + // Create set of linking flags. std::string linkFlags; - this->LocalGenerator->AppendFlags(linkFlags, extraFlags); + this->GetTargetLinkFlags(linkFlags, linkLanguage); // Get the name of the device object to generate. std::string const targetOutputReal = @@ -458,7 +433,6 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules( this->WriteTargetDriverRule(targetOutputReal, relink); #else static_cast<void>(linkRuleVar); - static_cast<void>(extraFlags); static_cast<void>(relink); #endif } @@ -470,13 +444,6 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // code duplication. std::vector<std::string> commands; - // Build list of dependencies. - std::vector<std::string> depends; - this->AppendLinkDepends(depends); - if (!this->DeviceLinkObject.empty()) { - depends.push_back(this->DeviceLinkObject); - } - // Get the language to use for linking this library. std::string linkLanguage = this->GeneratorTarget->GetLinkerLanguage(this->ConfigName); @@ -488,6 +455,13 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( return; } + // Build list of dependencies. + std::vector<std::string> depends; + this->AppendLinkDepends(depends, linkLanguage); + if (!this->DeviceLinkObject.empty()) { + depends.push_back(this->DeviceLinkObject); + } + // Create set of linking flags. std::string linkFlags; this->LocalGenerator->AppendFlags(linkFlags, extraFlags); @@ -661,7 +635,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY) { libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), - (targetFullPath + ".manifest").c_str())); + targetFullPath + ".manifest")); } #endif |