ENH: Pass config to cmTarget::GetLinkerLanguage

This passes the build configuration to most GetLinkerLanguage calls.  In
the future the linker language will account for targets linked in each
configuration.
This commit is contained in:
Brad King 2009-07-08 13:04:04 -04:00
parent a3a046643a
commit 173448d988
8 changed files with 27 additions and 18 deletions

View File

@ -264,7 +264,7 @@ cmComputeLinkInformation
this->OrderDependentRPath = 0;
// Get the language used for linking this target.
this->LinkLanguage = this->Target->GetLinkerLanguage();
this->LinkLanguage = this->Target->GetLinkerLanguage(config);
if(!this->LinkLanguage)
{
// The Compute method will do nothing, so skip the rest of the

View File

@ -1378,7 +1378,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
bool shared = ((target.GetType() == cmTarget::SHARED_LIBRARY) ||
(target.GetType() == cmTarget::MODULE_LIBRARY));
const char* lang = target.GetLinkerLanguage();
const char* lang = target.GetLinkerLanguage(configName);
std::string cflags;
if(lang)
{

View File

@ -656,7 +656,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
std::string flags;
if(strcmp(configType, "10") != 0)
{
const char* linkLanguage = target.GetLinkerLanguage();
const char* linkLanguage = target.GetLinkerLanguage(configName);
if(!linkLanguage)
{
cmSystemTools::Error
@ -1362,7 +1362,7 @@ cmLocalVisualStudio7GeneratorFCInfo
lg->GlobalGenerator->GetLanguageFromExtension
(sf.GetExtension().c_str());
const char* sourceLang = lg->GetSourceFileLanguage(sf);
const char* linkLanguage = target.GetLinkerLanguage();
const char* linkLanguage = target.GetLinkerLanguage(i->c_str());
bool needForceLang = false;
// source file does not match its extension language
if(lang && sourceLang && strcmp(lang, sourceLang) != 0)

View File

@ -178,7 +178,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
cmLocalGenerator::SHELL);
// Get the language to use for linking this executable.
const char* linkLanguage = this->Target->GetLinkerLanguage();
const char* linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName);
// Make sure we have a link language.
if(!linkLanguage)

View File

@ -109,7 +109,8 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
//----------------------------------------------------------------------------
void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
{
const char* linkLanguage = this->Target->GetLinkerLanguage();
const char* linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName);
std::string linkRuleVar = "CMAKE_";
if (linkLanguage)
{
@ -131,7 +132,8 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
this->WriteFrameworkRules(relink);
return;
}
const char* linkLanguage = this->Target->GetLinkerLanguage();
const char* linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName);
std::string linkRuleVar = "CMAKE_";
if (linkLanguage)
{
@ -176,7 +178,8 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
//----------------------------------------------------------------------------
void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
{
const char* linkLanguage = this->Target->GetLinkerLanguage();
const char* linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName);
std::string linkRuleVar = "CMAKE_";
if (linkLanguage)
{
@ -201,7 +204,8 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
//----------------------------------------------------------------------------
void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink)
{
const char* linkLanguage = this->Target->GetLinkerLanguage();
const char* linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName);
std::string linkRuleVar = "CMAKE_";
if (linkLanguage)
{
@ -347,7 +351,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
}
// Get the language to use for linking this library.
const char* linkLanguage = this->Target->GetLinkerLanguage();
const char* linkLanguage =
this->Target->GetLinkerLanguage(this->ConfigName);
// Make sure we have a link language.
if(!linkLanguage)

View File

@ -2320,7 +2320,7 @@ bool cmTarget::GetPropertyAsBool(const char* prop)
}
//----------------------------------------------------------------------------
const char* cmTarget::GetLinkerLanguage()
const char* cmTarget::GetLinkerLanguage(const char*)
{
cmGlobalGenerator* gg =
this->Makefile->GetLocalGenerator()->GetGlobalGenerator();
@ -2772,7 +2772,7 @@ void cmTarget::GetLibraryNames(std::string& name,
}
// Construct the name of the soname flag variable for this language.
const char* ll = this->GetLinkerLanguage();
const char* ll = this->GetLinkerLanguage(config);
std::string sonameFlag = "CMAKE_SHARED_LIBRARY_SONAME";
if(ll)
{
@ -3062,7 +3062,7 @@ bool cmTarget::NeedRelinkBeforeInstall(const char* config)
}
// Check for rpath support on this platform.
if(const char* ll = this->GetLinkerLanguage())
if(const char* ll = this->GetLinkerLanguage(config))
{
std::string flagVar = "CMAKE_SHARED_LIBRARY_RUNTIME_";
flagVar += ll;
@ -3387,7 +3387,7 @@ bool cmTarget::IsChrpathUsed(const char* config)
// Enable if the rpath flag uses a separator and the target uses ELF
// binaries.
if(const char* ll = this->GetLinkerLanguage())
if(const char* ll = this->GetLinkerLanguage(config))
{
std::string sepVar = "CMAKE_SHARED_LIBRARY_RUNTIME_";
sepVar += ll;

View File

@ -305,7 +305,7 @@ public:
bool FindSourceFiles();
///! Return the prefered linker language for this target
const char* GetLinkerLanguage();
const char* GetLinkerLanguage(const char* config = 0);
///! Return the rule variable used to create this type of target,
// need to add CMAKE_(LANG) for full name.

View File

@ -582,7 +582,8 @@ OutputLinkIncremental(std::string const& configName)
// assume incremental linking
const char* incremental = "true";
const char* linkLanguage = this->Target->GetLinkerLanguage();
const char* linkLanguage =
this->Target->GetLinkerLanguage(configName.c_str());
if(!linkLanguage)
{
cmSystemTools::Error
@ -638,7 +639,8 @@ WriteClOptions(std::string const& configName,
// collect up flags for
if(this->Target->GetType() < cmTarget::UTILITY)
{
const char* linkLanguage = this->Target->GetLinkerLanguage();
const char* linkLanguage =
this->Target->GetLinkerLanguage(configName.c_str());
if(!linkLanguage)
{
cmSystemTools::Error
@ -772,7 +774,8 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&
{
return;
}
const char* linkLanguage = this->Target->GetLinkerLanguage();
const char* linkLanguage =
this->Target->GetLinkerLanguage(config.c_str());
if(!linkLanguage)
{
cmSystemTools::Error