mirror of
https://github.com/reactos/CMake.git
synced 2025-01-22 11:24:56 +00:00
Makefile generator: link flags management refactoring
This commit is contained in:
parent
074bb25ca0
commit
8e28d2630a
@ -154,12 +154,7 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule(
|
||||
linkLanguage, this->ConfigName);
|
||||
|
||||
// Add target-specific linker flags.
|
||||
this->LocalGenerator->AppendFlags(
|
||||
linkFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
|
||||
std::string linkFlagsConfig = "LINK_FLAGS_";
|
||||
linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
|
||||
this->LocalGenerator->AppendFlags(
|
||||
linkFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
|
||||
this->GetTargetLinkFlags(linkFlags);
|
||||
|
||||
// Construct a list of files associated with this executable that
|
||||
// may need to be cleaned.
|
||||
@ -437,12 +432,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||
linkLanguage, this->ConfigName);
|
||||
|
||||
// Add target-specific linker flags.
|
||||
this->LocalGenerator->AppendFlags(
|
||||
linkFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
|
||||
std::string linkFlagsConfig = "LINK_FLAGS_";
|
||||
linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
|
||||
this->LocalGenerator->AppendFlags(
|
||||
linkFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
|
||||
this->GetTargetLinkFlags(linkFlags);
|
||||
|
||||
{
|
||||
std::unique_ptr<cmLinkLineComputer> linkLineComputer(
|
||||
|
@ -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 =
|
||||
@ -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);
|
||||
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);
|
||||
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);
|
||||
this->LocalGenerator->AddConfigVariableFlags(
|
||||
extraFlags, "CMAKE_MACOSX_FRAMEWORK_LINKER_FLAGS", this->ConfigName);
|
||||
|
||||
@ -278,7 +253,7 @@ 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
|
||||
@ -296,7 +271,7 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
|
||||
|
||||
// Create set of linking flags.
|
||||
std::string linkFlags;
|
||||
this->LocalGenerator->AppendFlags(linkFlags, extraFlags);
|
||||
this->GetTargetLinkFlags(linkFlags);
|
||||
|
||||
// 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
|
||||
}
|
||||
|
@ -27,8 +27,7 @@ protected:
|
||||
void WriteSharedLibraryRules(bool relink);
|
||||
void WriteModuleLibraryRules(bool relink);
|
||||
|
||||
void WriteDeviceLibraryRules(const std::string& linkRule,
|
||||
const std::string& extraFlags, bool relink);
|
||||
void WriteDeviceLibraryRules(const std::string& linkRule, bool relink);
|
||||
void WriteLibraryRules(const std::string& linkRule,
|
||||
const std::string& extraFlags, bool relink);
|
||||
// MacOSX Framework support methods
|
||||
|
@ -82,6 +82,17 @@ cmMakefileTargetGenerator* cmMakefileTargetGenerator::New(
|
||||
return result;
|
||||
}
|
||||
|
||||
void cmMakefileTargetGenerator::GetTargetLinkFlags(std::string& flags)
|
||||
{
|
||||
this->LocalGenerator->AppendFlags(
|
||||
flags, this->GeneratorTarget->GetProperty("LINK_FLAGS"));
|
||||
|
||||
std::string linkFlagsConfig = "LINK_FLAGS_";
|
||||
linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
|
||||
this->LocalGenerator->AppendFlags(
|
||||
flags, this->GeneratorTarget->GetProperty(linkFlagsConfig));
|
||||
}
|
||||
|
||||
void cmMakefileTargetGenerator::CreateRuleFile()
|
||||
{
|
||||
// Create a directory for this target.
|
||||
|
@ -52,6 +52,8 @@ public:
|
||||
cmGeneratorTarget* GetGeneratorTarget() { return this->GeneratorTarget; }
|
||||
|
||||
protected:
|
||||
void GetTargetLinkFlags(std::string& flags);
|
||||
|
||||
// create the file and directory etc
|
||||
void CreateRuleFile();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user