summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-09-28 19:05:54 (GMT)
committerBrad King <brad.king@kitware.com>2022-09-29 19:03:37 (GMT)
commita7fb4bc4750ed2d8f4eb6e2aca312cc35b8e96cc (patch)
treec5a1df52dbd39542e595f60c0cf79b94d01a4624 /Source/cmGlobalXCodeGenerator.cxx
parent6883b8212443028fbfff32863e004b311c7f26e8 (diff)
downloadCMake-a7fb4bc4750ed2d8f4eb6e2aca312cc35b8e96cc.zip
CMake-a7fb4bc4750ed2d8f4eb6e2aca312cc35b8e96cc.tar.gz
CMake-a7fb4bc4750ed2d8f4eb6e2aca312cc35b8e96cc.tar.bz2
Xcode: Set build product locations using CONFIGURATION_BUILD_DIR
Since commit 59a2265576 (Xcode: Use EFFECTIVE_PLATFORM_NAME reference in ComputeOutputDir, 2011-08-12, v2.8.6~43^2~1) we can now set the build products path using `CONFIGURATION_BUILD_DIR` unconditionally because we compute the correct value even when using `EFFECTIVE_PLATFORM_NAME`. This avoids relying on `SYMROOT` to locate the build products. Issue: #22550
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx24
1 files changed, 13 insertions, 11 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index efa2d02..6f82cb5 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2518,18 +2518,25 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
soName += *soversion;
}
+ if (gtgt->CanCompileSources()) {
+ std::string outDir;
+ if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) {
+ // We cannot suppress the archive, so hide it with intermediate files.
+ outDir = this->GetObjectsDirectory(this->CurrentProject, configName,
+ gtgt, OBJECT_LIBRARY_ARTIFACT_DIR);
+ } else {
+ outDir = gtgt->GetDirectory(configName);
+ }
+ buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
+ this->CreateString(outDir));
+ }
+
// Set attributes to specify the proper name for the target.
std::string pndir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory();
if (gtgt->GetType() == cmStateEnums::STATIC_LIBRARY ||
gtgt->GetType() == cmStateEnums::SHARED_LIBRARY ||
gtgt->GetType() == cmStateEnums::MODULE_LIBRARY ||
gtgt->GetType() == cmStateEnums::EXECUTABLE) {
- if (!gtgt->UsesDefaultOutputDir(configName,
- cmStateEnums::RuntimeBinaryArtifact)) {
- std::string pncdir = gtgt->GetDirectory(configName);
- buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
- this->CreateString(pncdir));
- }
if (gtgt->IsFrameworkOnApple() || gtgt->IsCFBundleOnApple()) {
pnprefix = "";
@@ -2539,11 +2546,6 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
this->CreateString(pnprefix));
buildSettings->AddAttribute("EXECUTABLE_SUFFIX",
this->CreateString(pnsuffix));
- } else if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) {
- std::string pncdir = this->GetObjectsDirectory(
- this->CurrentProject, configName, gtgt, OBJECT_LIBRARY_ARTIFACT_DIR);
- buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
- this->CreateString(pncdir));
}
// Store the product name for all target types.