summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileLibraryTargetGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmMakefileLibraryTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx92
1 files changed, 48 insertions, 44 deletions
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 54a6606..872521c 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -36,11 +36,10 @@ cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator(
this->CustomCommandDriver = OnDepends;
if (this->GeneratorTarget->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
this->TargetNames =
- this->GeneratorTarget->GetLibraryNames(this->ConfigName);
+ this->GeneratorTarget->GetLibraryNames(this->GetConfigName());
}
- this->OSXBundleGenerator =
- cm::make_unique<cmOSXBundleGenerator>(target, this->ConfigName);
+ this->OSXBundleGenerator = cm::make_unique<cmOSXBundleGenerator>(target);
this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
}
@@ -69,14 +68,16 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
break;
case cmStateEnums::SHARED_LIBRARY:
this->WriteSharedLibraryRules(false);
- if (this->GeneratorTarget->NeedRelinkBeforeInstall(this->ConfigName)) {
+ if (this->GeneratorTarget->NeedRelinkBeforeInstall(
+ this->GetConfigName())) {
// Write rules to link an installable version of the target.
this->WriteSharedLibraryRules(true);
}
break;
case cmStateEnums::MODULE_LIBRARY:
this->WriteModuleLibraryRules(false);
- if (this->GeneratorTarget->NeedRelinkBeforeInstall(this->ConfigName)) {
+ if (this->GeneratorTarget->NeedRelinkBeforeInstall(
+ this->GetConfigName())) {
// Write rules to link an installable version of the target.
this->WriteModuleLibraryRules(true);
}
@@ -126,21 +127,21 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules()
void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
{
const bool requiresDeviceLinking = requireDeviceLinking(
- *this->GeneratorTarget, *this->LocalGenerator, this->ConfigName);
+ *this->GeneratorTarget, *this->LocalGenerator, this->GetConfigName());
if (requiresDeviceLinking) {
std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY";
this->WriteDeviceLibraryRules(linkRuleVar, false);
}
std::string linkLanguage =
- this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
+ this->GeneratorTarget->GetLinkerLanguage(this->GetConfigName());
std::string linkRuleVar = this->GeneratorTarget->GetCreateRuleVariable(
- linkLanguage, this->ConfigName);
+ linkLanguage, this->GetConfigName());
std::string extraFlags;
this->LocalGenerator->GetStaticLibraryFlags(
- extraFlags, cmSystemTools::UpperCase(this->ConfigName), linkLanguage,
+ extraFlags, cmSystemTools::UpperCase(this->GetConfigName()), linkLanguage,
this->GeneratorTarget);
this->WriteLibraryRules(linkRuleVar, extraFlags, false);
}
@@ -154,7 +155,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
if (!relink) {
const bool requiresDeviceLinking = requireDeviceLinking(
- *this->GeneratorTarget, *this->LocalGenerator, this->ConfigName);
+ *this->GeneratorTarget, *this->LocalGenerator, this->GetConfigName());
if (requiresDeviceLinking) {
std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY";
this->WriteDeviceLibraryRules(linkRuleVar, relink);
@@ -162,21 +163,22 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink)
}
std::string linkLanguage =
- this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
+ this->GeneratorTarget->GetLinkerLanguage(this->GetConfigName());
std::string linkRuleVar =
cmStrCat("CMAKE_", linkLanguage, "_CREATE_SHARED_LIBRARY");
std::string extraFlags;
this->GetTargetLinkFlags(extraFlags, linkLanguage);
this->LocalGenerator->AddConfigVariableFlags(
- extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->ConfigName);
+ extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->GetConfigName());
std::unique_ptr<cmLinkLineComputer> linkLineComputer(
this->CreateLinkLineComputer(
this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
- this->AddModuleDefinitionFlag(linkLineComputer.get(), extraFlags);
+ this->AddModuleDefinitionFlag(linkLineComputer.get(), extraFlags,
+ this->GetConfigName());
if (this->GeneratorTarget->GetPropertyAsBool("LINK_WHAT_YOU_USE")) {
this->LocalGenerator->AppendFlags(extraFlags, " -Wl,--no-as-needed");
@@ -188,7 +190,7 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
{
if (!relink) {
const bool requiresDeviceLinking = requireDeviceLinking(
- *this->GeneratorTarget, *this->LocalGenerator, this->ConfigName);
+ *this->GeneratorTarget, *this->LocalGenerator, this->GetConfigName());
if (requiresDeviceLinking) {
std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY";
this->WriteDeviceLibraryRules(linkRuleVar, relink);
@@ -196,21 +198,22 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
}
std::string linkLanguage =
- this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
+ this->GeneratorTarget->GetLinkerLanguage(this->GetConfigName());
std::string linkRuleVar =
cmStrCat("CMAKE_", linkLanguage, "_CREATE_SHARED_MODULE");
std::string extraFlags;
this->GetTargetLinkFlags(extraFlags, linkLanguage);
this->LocalGenerator->AddConfigVariableFlags(
- extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->ConfigName);
+ extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->GetConfigName());
std::unique_ptr<cmLinkLineComputer> linkLineComputer(
this->CreateLinkLineComputer(
this->LocalGenerator,
this->LocalGenerator->GetStateSnapshot().GetDirectory()));
- this->AddModuleDefinitionFlag(linkLineComputer.get(), extraFlags);
+ this->AddModuleDefinitionFlag(linkLineComputer.get(), extraFlags,
+ this->GetConfigName());
this->WriteLibraryRules(linkRuleVar, extraFlags, relink);
}
@@ -218,14 +221,14 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink)
void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink)
{
std::string linkLanguage =
- this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
+ this->GeneratorTarget->GetLinkerLanguage(this->GetConfigName());
std::string linkRuleVar =
cmStrCat("CMAKE_", linkLanguage, "_CREATE_MACOSX_FRAMEWORK");
std::string extraFlags;
this->GetTargetLinkFlags(extraFlags, linkLanguage);
this->LocalGenerator->AddConfigVariableFlags(
- extraFlags, "CMAKE_MACOSX_FRAMEWORK_LINKER_FLAGS", this->ConfigName);
+ extraFlags, "CMAKE_MACOSX_FRAMEWORK_LINKER_FLAGS", this->GetConfigName());
this->WriteLibraryRules(linkRuleVar, extraFlags, relink);
}
@@ -331,7 +334,8 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
this->LocalGenerator->GetCurrentBinaryDirectory(), targetOutputReal),
output);
- std::string targetFullPathCompilePDB = this->ComputeTargetCompilePDB();
+ std::string targetFullPathCompilePDB =
+ this->ComputeTargetCompilePDB(this->GetConfigName());
std::string targetOutPathCompilePDB =
this->LocalGenerator->ConvertToOutputFormat(targetFullPathCompilePDB,
cmOutputConverter::SHELL);
@@ -347,7 +351,7 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules(
// Add language-specific flags.
std::string langFlags;
this->LocalGenerator->AddLanguageFlagsForLinking(
- langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName);
+ langFlags, this->GeneratorTarget, linkLanguage, this->GetConfigName());
vars.LanguageCompileFlags = langFlags.c_str();
@@ -420,7 +424,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Get the language to use for linking this library.
std::string linkLanguage =
- this->GeneratorTarget->GetLinkerLanguage(this->ConfigName);
+ this->GeneratorTarget->GetLinkerLanguage(this->GetConfigName());
// Make sure we have a link language.
if (linkLanguage.empty()) {
@@ -439,8 +443,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Create set of linking flags.
std::string linkFlags;
this->LocalGenerator->AppendFlags(linkFlags, extraFlags);
- this->LocalGenerator->AppendIPOLinkerFlags(linkFlags, this->GeneratorTarget,
- this->ConfigName, linkLanguage);
+ this->LocalGenerator->AppendIPOLinkerFlags(
+ linkFlags, this->GeneratorTarget, this->GetConfigName(), linkLanguage);
// Add OSX version flags, if any.
if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
@@ -450,20 +454,20 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
}
// Construct the name of the library.
- this->GeneratorTarget->GetLibraryNames(this->ConfigName);
+ this->GeneratorTarget->GetLibraryNames(this->GetConfigName());
// Construct the full path version of the names.
std::string outpath;
std::string outpathImp;
if (this->GeneratorTarget->IsFrameworkOnApple()) {
- outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
+ outpath = this->GeneratorTarget->GetDirectory(this->GetConfigName());
this->OSXBundleGenerator->CreateFramework(this->TargetNames.Output,
- outpath);
+ outpath, this->GetConfigName());
outpath += '/';
} else if (this->GeneratorTarget->IsCFBundleOnApple()) {
- outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
- this->OSXBundleGenerator->CreateCFBundle(this->TargetNames.Output,
- outpath);
+ outpath = this->GeneratorTarget->GetDirectory(this->GetConfigName());
+ this->OSXBundleGenerator->CreateCFBundle(this->TargetNames.Output, outpath,
+ this->GetConfigName());
outpath += '/';
} else if (relink) {
outpath = cmStrCat(this->Makefile->GetCurrentBinaryDirectory(),
@@ -474,23 +478,23 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
outpathImp = outpath;
}
} else {
- outpath = this->GeneratorTarget->GetDirectory(this->ConfigName);
+ outpath = this->GeneratorTarget->GetDirectory(this->GetConfigName());
cmSystemTools::MakeDirectory(outpath);
outpath += '/';
if (!this->TargetNames.ImportLibrary.empty()) {
outpathImp = this->GeneratorTarget->GetDirectory(
- this->ConfigName, cmStateEnums::ImportLibraryArtifact);
+ this->GetConfigName(), cmStateEnums::ImportLibraryArtifact);
cmSystemTools::MakeDirectory(outpathImp);
outpathImp += '/';
}
}
std::string compilePdbOutputPath =
- this->GeneratorTarget->GetCompilePDBDirectory(this->ConfigName);
+ this->GeneratorTarget->GetCompilePDBDirectory(this->GetConfigName());
cmSystemTools::MakeDirectory(compilePdbOutputPath);
std::string pdbOutputPath =
- this->GeneratorTarget->GetPDBDirectory(this->ConfigName);
+ this->GeneratorTarget->GetPDBDirectory(this->GetConfigName());
cmSystemTools::MakeDirectory(pdbOutputPath);
pdbOutputPath += "/";
@@ -586,7 +590,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
targetFullPathImport));
std::string implib;
if (this->GeneratorTarget->GetImplibGNUtoMS(
- this->ConfigName, targetFullPathImport, implib)) {
+ this->GetConfigName(), targetFullPathImport, implib)) {
libCleanFiles.insert(this->LocalGenerator->MaybeConvertToRelativePath(
this->LocalGenerator->GetCurrentBinaryDirectory(), implib));
}
@@ -638,7 +642,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
cmStrCat("CMAKE_", linkLanguage, "_ARCHIVE_CREATE");
arCreateVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable(
- arCreateVar, linkLanguage, this->ConfigName);
+ arCreateVar, linkLanguage, this->GetConfigName());
if (const char* rule = this->Makefile->GetDefinition(arCreateVar)) {
cmExpandList(rule, archiveCreateCommands);
@@ -647,7 +651,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
cmStrCat("CMAKE_", linkLanguage, "_ARCHIVE_APPEND");
arAppendVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable(
- arAppendVar, linkLanguage, this->ConfigName);
+ arAppendVar, linkLanguage, this->GetConfigName());
if (const char* rule = this->Makefile->GetDefinition(arAppendVar)) {
cmExpandList(rule, archiveAppendCommands);
@@ -656,7 +660,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
cmStrCat("CMAKE_", linkLanguage, "_ARCHIVE_FINISH");
arFinishVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable(
- arFinishVar, linkLanguage, this->ConfigName);
+ arFinishVar, linkLanguage, this->GetConfigName());
if (const char* rule = this->Makefile->GetDefinition(arFinishVar)) {
cmExpandList(rule, archiveFinishCommands);
@@ -726,7 +730,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// maybe create .def file from list of objects
this->GenDefFile(real_link_commands);
- std::string manifests = this->GetManifests();
+ std::string manifests = this->GetManifests(this->GetConfigName());
cmRulePlaceholderExpander::RuleVariables vars;
vars.TargetPDB = targetOutPathPDB.c_str();
@@ -771,7 +775,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
vars.Target = target.c_str();
vars.LinkLibraries = linkLibs.c_str();
vars.ObjectsQuoted = buildObjs.c_str();
- if (this->GeneratorTarget->HasSOName(this->ConfigName)) {
+ if (this->GeneratorTarget->HasSOName(this->GetConfigName())) {
vars.SONameFlag = this->Makefile->GetSONameFlag(linkLanguage);
vars.TargetSOName = this->TargetNames.SharedObject.c_str();
}
@@ -783,8 +787,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
std::string install_name_dir;
if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY) {
// Get the install_name directory for the build tree.
- install_name_dir =
- this->GeneratorTarget->GetInstallNameDirForBuildTree(this->ConfigName);
+ install_name_dir = this->GeneratorTarget->GetInstallNameDirForBuildTree(
+ this->GetConfigName());
// Set the rule variable replacement value.
if (install_name_dir.empty()) {
@@ -800,10 +804,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Add language-specific flags.
std::string langFlags;
this->LocalGenerator->AddLanguageFlagsForLinking(
- langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName);
+ langFlags, this->GeneratorTarget, linkLanguage, this->GetConfigName());
this->LocalGenerator->AddArchitectureFlags(
- langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName);
+ langFlags, this->GeneratorTarget, linkLanguage, this->GetConfigName());
vars.LanguageCompileFlags = langFlags.c_str();