ENH: Create cmMakefileTargetGenerator::ConfigName
This member stores the build configuration for which Makefiles are being generated. It saves repeated lookup of the equivalent member from cmLocalUnixMakefileGenerator3, making code shorter and more readable.
This commit is contained in:
parent
789eaf157c
commit
11d1063452
@ -32,7 +32,7 @@ cmMakefileExecutableTargetGenerator
|
|||||||
this->CustomCommandDriver = OnDepends;
|
this->CustomCommandDriver = OnDepends;
|
||||||
this->Target->GetExecutableNames(
|
this->Target->GetExecutableNames(
|
||||||
this->TargetNameOut, this->TargetNameReal, this->TargetNameImport,
|
this->TargetNameOut, this->TargetNameReal, this->TargetNameImport,
|
||||||
this->TargetNamePDB, this->LocalGenerator->ConfigurationName.c_str());
|
this->TargetNamePDB, this->ConfigName);
|
||||||
|
|
||||||
if(this->Target->IsAppBundleOnApple())
|
if(this->Target->IsAppBundleOnApple())
|
||||||
{
|
{
|
||||||
@ -123,7 +123,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
|||||||
std::string targetNamePDB;
|
std::string targetNamePDB;
|
||||||
this->Target->GetExecutableNames
|
this->Target->GetExecutableNames
|
||||||
(targetName, targetNameReal, targetNameImport, targetNamePDB,
|
(targetName, targetNameReal, targetNameImport, targetNamePDB,
|
||||||
this->LocalGenerator->ConfigurationName.c_str());
|
this->ConfigName);
|
||||||
|
|
||||||
// Construct the full path version of the names.
|
// Construct the full path version of the names.
|
||||||
std::string outpath = this->Target->GetDirectory();
|
std::string outpath = this->Target->GetDirectory();
|
||||||
@ -212,7 +212,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
|||||||
// Add flags to create an executable.
|
// Add flags to create an executable.
|
||||||
this->LocalGenerator->
|
this->LocalGenerator->
|
||||||
AddConfigVariableFlags(linkFlags, "CMAKE_EXE_LINKER_FLAGS",
|
AddConfigVariableFlags(linkFlags, "CMAKE_EXE_LINKER_FLAGS",
|
||||||
this->LocalGenerator->ConfigurationName.c_str());
|
this->ConfigName);
|
||||||
|
|
||||||
|
|
||||||
if(this->Target->GetPropertyAsBool("WIN32_EXECUTABLE"))
|
if(this->Target->GetPropertyAsBool("WIN32_EXECUTABLE"))
|
||||||
@ -238,15 +238,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
|||||||
|
|
||||||
// Add language-specific flags.
|
// Add language-specific flags.
|
||||||
this->LocalGenerator
|
this->LocalGenerator
|
||||||
->AddLanguageFlags(flags, linkLanguage,
|
->AddLanguageFlags(flags, linkLanguage, this->ConfigName);
|
||||||
this->LocalGenerator->ConfigurationName.c_str());
|
|
||||||
|
|
||||||
// Add target-specific linker flags.
|
// Add target-specific linker flags.
|
||||||
this->LocalGenerator->AppendFlags
|
this->LocalGenerator->AppendFlags
|
||||||
(linkFlags, this->Target->GetProperty("LINK_FLAGS"));
|
(linkFlags, this->Target->GetProperty("LINK_FLAGS"));
|
||||||
std::string linkFlagsConfig = "LINK_FLAGS_";
|
std::string linkFlagsConfig = "LINK_FLAGS_";
|
||||||
linkFlagsConfig +=
|
linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
|
||||||
cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName.c_str());
|
|
||||||
this->LocalGenerator->AppendFlags
|
this->LocalGenerator->AppendFlags
|
||||||
(linkFlags, this->Target->GetProperty(linkFlagsConfig.c_str()));
|
(linkFlags, this->Target->GetProperty(linkFlagsConfig.c_str()));
|
||||||
|
|
||||||
|
@ -34,8 +34,7 @@ cmMakefileLibraryTargetGenerator
|
|||||||
this->CustomCommandDriver = OnDepends;
|
this->CustomCommandDriver = OnDepends;
|
||||||
this->Target->GetLibraryNames(
|
this->Target->GetLibraryNames(
|
||||||
this->TargetNameOut, this->TargetNameSO, this->TargetNameReal,
|
this->TargetNameOut, this->TargetNameSO, this->TargetNameReal,
|
||||||
this->TargetNameImport, this->TargetNamePDB,
|
this->TargetNameImport, this->TargetNamePDB, this->ConfigName);
|
||||||
this->LocalGenerator->ConfigurationName.c_str());
|
|
||||||
|
|
||||||
if(this->Target->IsFrameworkOnApple())
|
if(this->Target->IsFrameworkOnApple())
|
||||||
{
|
{
|
||||||
@ -146,14 +145,12 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
|
|||||||
this->LocalGenerator->AppendFlags
|
this->LocalGenerator->AppendFlags
|
||||||
(extraFlags, this->Target->GetProperty("LINK_FLAGS"));
|
(extraFlags, this->Target->GetProperty("LINK_FLAGS"));
|
||||||
std::string linkFlagsConfig = "LINK_FLAGS_";
|
std::string linkFlagsConfig = "LINK_FLAGS_";
|
||||||
linkFlagsConfig +=
|
linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
|
||||||
cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName.c_str());
|
|
||||||
this->LocalGenerator->AppendFlags
|
this->LocalGenerator->AppendFlags
|
||||||
(extraFlags, this->Target->GetProperty(linkFlagsConfig.c_str()));
|
(extraFlags, this->Target->GetProperty(linkFlagsConfig.c_str()));
|
||||||
|
|
||||||
this->LocalGenerator->AddConfigVariableFlags
|
this->LocalGenerator->AddConfigVariableFlags
|
||||||
(extraFlags, "CMAKE_SHARED_LINKER_FLAGS",
|
(extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->ConfigName);
|
||||||
this->LocalGenerator->ConfigurationName.c_str());
|
|
||||||
if(this->Makefile->IsOn("WIN32") && !(this->Makefile->IsOn("CYGWIN")
|
if(this->Makefile->IsOn("WIN32") && !(this->Makefile->IsOn("CYGWIN")
|
||||||
|| this->Makefile->IsOn("MINGW")))
|
|| this->Makefile->IsOn("MINGW")))
|
||||||
{
|
{
|
||||||
@ -194,13 +191,11 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
|
|||||||
this->LocalGenerator->AppendFlags(extraFlags,
|
this->LocalGenerator->AppendFlags(extraFlags,
|
||||||
this->Target->GetProperty("LINK_FLAGS"));
|
this->Target->GetProperty("LINK_FLAGS"));
|
||||||
std::string linkFlagsConfig = "LINK_FLAGS_";
|
std::string linkFlagsConfig = "LINK_FLAGS_";
|
||||||
linkFlagsConfig +=
|
linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
|
||||||
cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName.c_str());
|
|
||||||
this->LocalGenerator->AppendFlags
|
this->LocalGenerator->AppendFlags
|
||||||
(extraFlags, this->Target->GetProperty(linkFlagsConfig.c_str()));
|
(extraFlags, this->Target->GetProperty(linkFlagsConfig.c_str()));
|
||||||
this->LocalGenerator->AddConfigVariableFlags
|
this->LocalGenerator->AddConfigVariableFlags
|
||||||
(extraFlags, "CMAKE_MODULE_LINKER_FLAGS",
|
(extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->ConfigName);
|
||||||
this->LocalGenerator->ConfigurationName.c_str());
|
|
||||||
|
|
||||||
// TODO: .def files should be supported here also.
|
// TODO: .def files should be supported here also.
|
||||||
this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), relink);
|
this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), relink);
|
||||||
@ -222,13 +217,11 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink)
|
|||||||
this->LocalGenerator->AppendFlags(extraFlags,
|
this->LocalGenerator->AppendFlags(extraFlags,
|
||||||
this->Target->GetProperty("LINK_FLAGS"));
|
this->Target->GetProperty("LINK_FLAGS"));
|
||||||
std::string linkFlagsConfig = "LINK_FLAGS_";
|
std::string linkFlagsConfig = "LINK_FLAGS_";
|
||||||
linkFlagsConfig +=
|
linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName);
|
||||||
cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName.c_str());
|
|
||||||
this->LocalGenerator->AppendFlags
|
this->LocalGenerator->AppendFlags
|
||||||
(extraFlags, this->Target->GetProperty(linkFlagsConfig.c_str()));
|
(extraFlags, this->Target->GetProperty(linkFlagsConfig.c_str()));
|
||||||
this->LocalGenerator->AddConfigVariableFlags
|
this->LocalGenerator->AddConfigVariableFlags
|
||||||
(extraFlags, "CMAKE_MACOSX_FRAMEWORK_LINKER_FLAGS",
|
(extraFlags, "CMAKE_MACOSX_FRAMEWORK_LINKER_FLAGS", this->ConfigName);
|
||||||
this->LocalGenerator->ConfigurationName.c_str());
|
|
||||||
|
|
||||||
// TODO: .def files should be supported here also.
|
// TODO: .def files should be supported here also.
|
||||||
this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), relink);
|
this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), relink);
|
||||||
@ -389,7 +382,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
|
|||||||
std::string targetNamePDB;
|
std::string targetNamePDB;
|
||||||
this->Target->GetLibraryNames(
|
this->Target->GetLibraryNames(
|
||||||
targetName, targetNameSO, targetNameReal, targetNameImport, targetNamePDB,
|
targetName, targetNameSO, targetNameReal, targetNameImport, targetNamePDB,
|
||||||
this->LocalGenerator->ConfigurationName.c_str());
|
this->ConfigName);
|
||||||
|
|
||||||
// Construct the full path version of the names.
|
// Construct the full path version of the names.
|
||||||
std::string outpath;
|
std::string outpath;
|
||||||
@ -685,8 +678,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
|
|||||||
if(this->Target->GetType() == cmTarget::SHARED_LIBRARY)
|
if(this->Target->GetType() == cmTarget::SHARED_LIBRARY)
|
||||||
{
|
{
|
||||||
// Get the install_name directory for the build tree.
|
// Get the install_name directory for the build tree.
|
||||||
const char* config = this->LocalGenerator->ConfigurationName.c_str();
|
install_name_dir =
|
||||||
install_name_dir = this->Target->GetInstallNameDirForBuildTree(config);
|
this->Target->GetInstallNameDirForBuildTree(this->ConfigName);
|
||||||
|
|
||||||
// Set the rule variable replacement value.
|
// Set the rule variable replacement value.
|
||||||
if(install_name_dir.empty())
|
if(install_name_dir.empty())
|
||||||
@ -705,8 +698,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
|
|||||||
}
|
}
|
||||||
std::string langFlags;
|
std::string langFlags;
|
||||||
this->LocalGenerator
|
this->LocalGenerator
|
||||||
->AddLanguageFlags(langFlags, linkLanguage,
|
->AddLanguageFlags(langFlags, linkLanguage, this->ConfigName);
|
||||||
this->LocalGenerator->ConfigurationName.c_str());
|
|
||||||
// remove any language flags that might not work with the
|
// remove any language flags that might not work with the
|
||||||
// particular os
|
// particular os
|
||||||
if(forbiddenFlagVar)
|
if(forbiddenFlagVar)
|
||||||
|
@ -43,6 +43,7 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmTarget* target)
|
|||||||
this->LocalGenerator =
|
this->LocalGenerator =
|
||||||
static_cast<cmLocalUnixMakefileGenerator3*>(
|
static_cast<cmLocalUnixMakefileGenerator3*>(
|
||||||
this->Makefile->GetLocalGenerator());
|
this->Makefile->GetLocalGenerator());
|
||||||
|
this->ConfigName = this->LocalGenerator->ConfigurationName.c_str();
|
||||||
this->GlobalGenerator =
|
this->GlobalGenerator =
|
||||||
static_cast<cmGlobalUnixMakefileGenerator3*>(
|
static_cast<cmGlobalUnixMakefileGenerator3*>(
|
||||||
this->LocalGenerator->GetGlobalGenerator());
|
this->LocalGenerator->GetGlobalGenerator());
|
||||||
@ -602,7 +603,6 @@ cmMakefileTargetGenerator
|
|||||||
std::string targetOutPathPDB;
|
std::string targetOutPathPDB;
|
||||||
{
|
{
|
||||||
std::string targetFullPathPDB;
|
std::string targetFullPathPDB;
|
||||||
const char* configName = this->LocalGenerator->ConfigurationName.c_str();
|
|
||||||
if(this->Target->GetType() == cmTarget::EXECUTABLE ||
|
if(this->Target->GetType() == cmTarget::EXECUTABLE ||
|
||||||
this->Target->GetType() == cmTarget::STATIC_LIBRARY ||
|
this->Target->GetType() == cmTarget::STATIC_LIBRARY ||
|
||||||
this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
|
this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
|
||||||
@ -610,7 +610,7 @@ cmMakefileTargetGenerator
|
|||||||
{
|
{
|
||||||
targetFullPathPDB = this->Target->GetDirectory();
|
targetFullPathPDB = this->Target->GetDirectory();
|
||||||
targetFullPathPDB += "/";
|
targetFullPathPDB += "/";
|
||||||
targetFullPathPDB += this->Target->GetPDBName(configName);
|
targetFullPathPDB += this->Target->GetPDBName(this->ConfigName);
|
||||||
}
|
}
|
||||||
targetOutPathPDB =
|
targetOutPathPDB =
|
||||||
this->Convert(targetFullPathPDB.c_str(),cmLocalGenerator::FULL,
|
this->Convert(targetFullPathPDB.c_str(),cmLocalGenerator::FULL,
|
||||||
|
@ -155,6 +155,7 @@ protected:
|
|||||||
cmLocalUnixMakefileGenerator3 *LocalGenerator;
|
cmLocalUnixMakefileGenerator3 *LocalGenerator;
|
||||||
cmGlobalUnixMakefileGenerator3 *GlobalGenerator;
|
cmGlobalUnixMakefileGenerator3 *GlobalGenerator;
|
||||||
cmMakefile *Makefile;
|
cmMakefile *Makefile;
|
||||||
|
const char *ConfigName;
|
||||||
|
|
||||||
enum CustomCommandDriveType { OnBuild, OnDepends, OnUtility };
|
enum CustomCommandDriveType { OnBuild, OnDepends, OnUtility };
|
||||||
CustomCommandDriveType CustomCommandDriver;
|
CustomCommandDriveType CustomCommandDriver;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user