mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 16:32:14 -06:00
Xcode: Refactor internal architecture list construction
Factor population of the `Architectures` member out into a helper to avoid duplication.
This commit is contained in:
@@ -282,13 +282,7 @@ void cmGlobalXCodeGenerator::EnableLanguage(
|
||||
}
|
||||
mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1");
|
||||
this->cmGlobalGenerator::EnableLanguage(lang, mf, optional);
|
||||
const char* osxArch = mf->GetDefinition("CMAKE_OSX_ARCHITECTURES");
|
||||
const char* sysroot = mf->GetDefinition("CMAKE_OSX_SYSROOT");
|
||||
if (osxArch && sysroot) {
|
||||
this->Architectures.clear();
|
||||
cmSystemTools::ExpandListArgument(std::string(osxArch),
|
||||
this->Architectures);
|
||||
}
|
||||
this->ComputeArchitectures(mf);
|
||||
}
|
||||
|
||||
void cmGlobalXCodeGenerator::GenerateBuildCommand(
|
||||
@@ -3089,23 +3083,16 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
|
||||
this->CreateString(defaultConfigName));
|
||||
cmXCodeObject* buildSettings =
|
||||
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
|
||||
const char* osxArch =
|
||||
this->CurrentMakefile->GetDefinition("CMAKE_OSX_ARCHITECTURES");
|
||||
const char* sysroot =
|
||||
this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT");
|
||||
const char* deploymentTarget =
|
||||
this->CurrentMakefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET");
|
||||
std::string archs;
|
||||
if (sysroot) {
|
||||
if (osxArch) {
|
||||
// recompute this as it may have been changed since enable language
|
||||
this->Architectures.clear();
|
||||
cmSystemTools::ExpandListArgument(std::string(osxArch),
|
||||
this->Architectures);
|
||||
archs = cmJoin(this->Architectures, " ");
|
||||
}
|
||||
buildSettings->AddAttribute("SDKROOT", this->CreateString(sysroot));
|
||||
}
|
||||
// recompute this as it may have been changed since enable language
|
||||
this->ComputeArchitectures(this->CurrentMakefile);
|
||||
std::string const archs = cmJoin(this->Architectures, " ");
|
||||
if (archs.empty()) {
|
||||
// Tell Xcode to use NATIVE_ARCH instead of ARCHS.
|
||||
buildSettings->AddAttribute("ONLY_ACTIVE_ARCH", this->CreateString("YES"));
|
||||
@@ -3212,6 +3199,17 @@ std::string cmGlobalXCodeGenerator::GetObjectsNormalDirectory(
|
||||
return dir;
|
||||
}
|
||||
|
||||
void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf)
|
||||
{
|
||||
this->Architectures.clear();
|
||||
const char* osxArch = mf->GetDefinition("CMAKE_OSX_ARCHITECTURES");
|
||||
const char* sysroot = mf->GetDefinition("CMAKE_OSX_SYSROOT");
|
||||
if (osxArch && sysroot) {
|
||||
cmSystemTools::ExpandListArgument(std::string(osxArch),
|
||||
this->Architectures);
|
||||
}
|
||||
}
|
||||
|
||||
void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
|
||||
std::vector<cmXCodeObject*>& targets)
|
||||
{
|
||||
|
||||
@@ -240,6 +240,8 @@ private:
|
||||
const std::string& configName,
|
||||
const cmGeneratorTarget* t) const;
|
||||
|
||||
void ComputeArchitectures(cmMakefile* mf);
|
||||
|
||||
void addObject(cmXCodeObject* obj);
|
||||
std::string PostBuildMakeTarget(std::string const& tName,
|
||||
std::string const& configName);
|
||||
|
||||
Reference in New Issue
Block a user