summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-10-31 13:42:10 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-10-31 13:42:29 (GMT)
commit5752150c648722a10679cdc696e35f273ba49bfc (patch)
tree22d1d9e79b022b43403fd9aca1b4e95d57cf7411 /Source/cmGlobalXCodeGenerator.cxx
parent0a2e26bcbfbcf273c2581ad81c405139513083d5 (diff)
parent024e3d2bf63c118f4a5da3ea872892ab274c697a (diff)
downloadCMake-5752150c648722a10679cdc696e35f273ba49bfc.zip
CMake-5752150c648722a10679cdc696e35f273ba49bfc.tar.gz
CMake-5752150c648722a10679cdc696e35f273ba49bfc.tar.bz2
Merge topic 'xcode-obj-dir'
024e3d2bf6 Xcode: Put object files in a place that Xcode cleans Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7843
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx29
1 files changed, 21 insertions, 8 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 6cba943..11520b4 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2544,8 +2544,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
}
if (gtgt->CanCompileSources()) {
- std::string tmpDir =
- cmStrCat(gtgt->GetSupportDirectory(), '/', this->GetCMakeCFGIntDir());
+ std::string const tmpDir =
+ this->GetTargetTempDir(gtgt, this->GetCMakeCFGIntDir());
buildSettings->AddAttribute("TARGET_TEMP_DIR", this->CreateString(tmpDir));
std::string outDir;
@@ -4399,7 +4399,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
this->CreateString(swiftVersion));
}
- std::string symroot = cmStrCat(root->GetCurrentBinaryDirectory(), "/build");
+ std::string const symroot = this->GetSymrootDir();
buildSettings->AddAttribute("SYMROOT", this->CreateString(symroot));
// Inside a try_compile project, do not require signing on any platform.
@@ -4506,6 +4506,19 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
return true;
}
+std::string cmGlobalXCodeGenerator::GetSymrootDir() const
+{
+ return cmStrCat(this->CMakeInstance->GetHomeOutputDirectory(), "/build");
+}
+
+std::string cmGlobalXCodeGenerator::GetTargetTempDir(
+ cmGeneratorTarget const* gt, std::string const& configName) const
+{
+ // Use a path inside the SYMROOT.
+ return cmStrCat(this->GetSymrootDir(), '/', gt->GetName(), ".build/",
+ configName);
+}
+
void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf)
{
this->Architectures.clear();
@@ -4629,8 +4642,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile(
for (auto objLib : objlibs) {
const std::string objLibName = objLib->GetName();
- std::string d = cmStrCat(objLib->GetSupportDirectory(), '/',
- configName, "/lib", objLibName, ".a");
+ std::string d = cmStrCat(this->GetTargetTempDir(gt, configName),
+ "/lib", objLibName, ".a");
std::string dependency = this->ConvertToRelativeForMake(d);
makefileStream << "\\\n\t" << dependency;
@@ -4644,8 +4657,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile(
// if building for more than one architecture
// then remove those executables as well
if (this->Architectures.size() > 1) {
- std::string universal = cmStrCat(gt->GetSupportDirectory(), '/',
- configName, "/$(OBJDIR)/");
+ std::string universal =
+ cmStrCat(this->GetTargetTempDir(gt, configName), "/$(OBJDIR)/");
for (const auto& architecture : this->Architectures) {
std::string universalFile = cmStrCat(universal, architecture, '/',
gt->GetFullName(configName));
@@ -5044,7 +5057,7 @@ void cmGlobalXCodeGenerator::ComputeTargetObjectDirectory(
{
auto objectDirArch = GetTargetObjectDirArch(*gt, this->ObjectDirArch);
gt->ObjectDirectory =
- cmStrCat(gt->GetSupportDirectory(), '/', this->GetCMakeCFGIntDir(),
+ cmStrCat(this->GetTargetTempDir(gt, this->GetCMakeCFGIntDir()),
"/$(OBJECT_FILE_DIR_normal:base)/", objectDirArch, '/');
}