mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-09 07:11:05 -06:00
Refactoring: Use ConfigName instead of property CMAKE_BUILD_TYPE
Use memorized `this->ConfigName` instead of retrieving the value of property CMAKE_BUILD_TYPE.
This commit is contained in:
@@ -161,8 +161,7 @@ void cmLocalUnixMakefileGenerator3::GetLocalObjectFiles(
|
||||
continue;
|
||||
}
|
||||
std::vector<cmSourceFile const*> objectSources;
|
||||
gt->GetObjectSources(
|
||||
objectSources, this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
|
||||
gt->GetObjectSources(objectSources, this->ConfigName);
|
||||
// Compute full path to object file directory for this target.
|
||||
std::string dir = cmStrCat(gt->LocalGenerator->GetCurrentBinaryDirectory(),
|
||||
'/', this->GetTargetDirectory(gt), '/');
|
||||
@@ -1864,9 +1863,8 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
|
||||
<< "_TARGET_INCLUDE_PATH\n";
|
||||
std::vector<std::string> includes;
|
||||
|
||||
const std::string& config =
|
||||
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||
this->GetIncludeDirectories(includes, target, implicitLang.first, config);
|
||||
this->GetIncludeDirectories(includes, target, implicitLang.first,
|
||||
this->ConfigName);
|
||||
std::string binaryDir = this->GetState()->GetBinaryDirectory();
|
||||
if (this->Makefile->IsOn("CMAKE_DEPENDS_IN_PROJECT_ONLY")) {
|
||||
std::string const& sourceDir = this->GetState()->GetSourceDirectory();
|
||||
|
||||
@@ -150,16 +150,13 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
|
||||
{
|
||||
// -- Write the custom commands for this target
|
||||
|
||||
const std::string& config =
|
||||
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||
|
||||
// Evaluates generator expressions and expands prop_value
|
||||
auto evaluatedFiles =
|
||||
[this, &config](const char* prop_value) -> std::vector<std::string> {
|
||||
[this](const char* prop_value) -> std::vector<std::string> {
|
||||
std::vector<std::string> files;
|
||||
cmGeneratorExpression ge;
|
||||
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop_value);
|
||||
cmExpandList(cge->Evaluate(this->LocalGenerator, config, false,
|
||||
cmExpandList(cge->Evaluate(this->LocalGenerator, this->ConfigName, false,
|
||||
this->GeneratorTarget, nullptr, nullptr),
|
||||
files);
|
||||
return files;
|
||||
@@ -191,7 +188,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
|
||||
// First generate the object rule files. Save a list of all object
|
||||
// files for this target.
|
||||
std::vector<cmSourceFile const*> customCommands;
|
||||
this->GeneratorTarget->GetCustomCommands(customCommands, config);
|
||||
this->GeneratorTarget->GetCustomCommands(customCommands, this->ConfigName);
|
||||
std::string currentBinDir =
|
||||
this->LocalGenerator->GetCurrentBinaryDirectory();
|
||||
for (cmSourceFile const* sf : customCommands) {
|
||||
@@ -233,17 +230,17 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
|
||||
}
|
||||
}
|
||||
std::vector<cmSourceFile const*> headerSources;
|
||||
this->GeneratorTarget->GetHeaderSources(headerSources, config);
|
||||
this->GeneratorTarget->GetHeaderSources(headerSources, this->ConfigName);
|
||||
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
|
||||
headerSources, this->MacOSXContentGenerator);
|
||||
std::vector<cmSourceFile const*> extraSources;
|
||||
this->GeneratorTarget->GetExtraSources(extraSources, config);
|
||||
this->GeneratorTarget->GetExtraSources(extraSources, this->ConfigName);
|
||||
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
|
||||
extraSources, this->MacOSXContentGenerator);
|
||||
const char* pchExtension =
|
||||
this->Makefile->GetDefinition("CMAKE_PCH_EXTENSION");
|
||||
std::vector<cmSourceFile const*> externalObjects;
|
||||
this->GeneratorTarget->GetExternalObjects(externalObjects, config);
|
||||
this->GeneratorTarget->GetExternalObjects(externalObjects, this->ConfigName);
|
||||
for (cmSourceFile const* sf : externalObjects) {
|
||||
auto const& objectFileName = sf->GetFullPath();
|
||||
if (!cmSystemTools::StringEndsWith(objectFileName, pchExtension)) {
|
||||
@@ -251,7 +248,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
|
||||
}
|
||||
}
|
||||
std::vector<cmSourceFile const*> objectSources;
|
||||
this->GeneratorTarget->GetObjectSources(objectSources, config);
|
||||
this->GeneratorTarget->GetObjectSources(objectSources, this->ConfigName);
|
||||
for (cmSourceFile const* sf : objectSources) {
|
||||
// Generate this object file's rule file.
|
||||
this->WriteObjectRuleFiles(*sf);
|
||||
@@ -1610,10 +1607,8 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
|
||||
{
|
||||
std::string frameworkPath;
|
||||
std::string linkPath;
|
||||
const std::string& config =
|
||||
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||
cmComputeLinkInformation* pcli =
|
||||
this->GeneratorTarget->GetLinkInformation(config);
|
||||
this->GeneratorTarget->GetLinkInformation(this->ConfigName);
|
||||
this->LocalGenerator->OutputLinkLibraries(pcli, linkLineComputer, linkLibs,
|
||||
frameworkPath, linkPath);
|
||||
linkLibs = frameworkPath + linkPath + linkLibs;
|
||||
@@ -1706,13 +1701,12 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
|
||||
bool useResponseFile = this->Makefile->IsOn(responseVar);
|
||||
|
||||
std::vector<std::string> includes;
|
||||
const std::string& config =
|
||||
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||
this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget,
|
||||
lang, config);
|
||||
lang, this->ConfigName);
|
||||
|
||||
std::string includeFlags = this->LocalGenerator->GetIncludeFlags(
|
||||
includes, this->GeneratorTarget, lang, false, useResponseFile, config);
|
||||
includes, this->GeneratorTarget, lang, false, useResponseFile,
|
||||
this->ConfigName);
|
||||
if (includeFlags.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -777,11 +777,9 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements()
|
||||
<< cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType())
|
||||
<< " target " << this->GetTargetName() << "\n\n";
|
||||
|
||||
const std::string& config =
|
||||
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||
{
|
||||
std::vector<cmSourceFile const*> customCommands;
|
||||
this->GeneratorTarget->GetCustomCommands(customCommands, config);
|
||||
this->GeneratorTarget->GetCustomCommands(customCommands, this->ConfigName);
|
||||
for (cmSourceFile const* sf : customCommands) {
|
||||
cmCustomCommand const* cc = sf->GetCustomCommand();
|
||||
this->GetLocalGenerator()->AddCustomCommandTarget(
|
||||
@@ -793,13 +791,13 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements()
|
||||
}
|
||||
{
|
||||
std::vector<cmSourceFile const*> headerSources;
|
||||
this->GeneratorTarget->GetHeaderSources(headerSources, config);
|
||||
this->GeneratorTarget->GetHeaderSources(headerSources, this->ConfigName);
|
||||
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
|
||||
headerSources, this->MacOSXContentGenerator.get());
|
||||
}
|
||||
{
|
||||
std::vector<cmSourceFile const*> extraSources;
|
||||
this->GeneratorTarget->GetExtraSources(extraSources, config);
|
||||
this->GeneratorTarget->GetExtraSources(extraSources, this->ConfigName);
|
||||
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
|
||||
extraSources, this->MacOSXContentGenerator.get());
|
||||
}
|
||||
@@ -808,7 +806,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements()
|
||||
GetMakefile()->GetDefinition("CMAKE_PCH_EXTENSION");
|
||||
|
||||
std::vector<cmSourceFile const*> externalObjects;
|
||||
this->GeneratorTarget->GetExternalObjects(externalObjects, config);
|
||||
this->GeneratorTarget->GetExternalObjects(externalObjects,
|
||||
this->ConfigName);
|
||||
for (cmSourceFile const* sf : externalObjects) {
|
||||
const auto objectFileName = this->GetSourceFilePath(sf);
|
||||
if (!cmSystemTools::StringEndsWith(objectFileName, pchExtension)) {
|
||||
@@ -863,7 +862,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements()
|
||||
|
||||
{
|
||||
std::vector<cmSourceFile const*> objectSources;
|
||||
this->GeneratorTarget->GetObjectSources(objectSources, config);
|
||||
this->GeneratorTarget->GetObjectSources(objectSources, this->ConfigName);
|
||||
for (cmSourceFile const* sf : objectSources) {
|
||||
this->WriteObjectBuildStatement(sf);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user