summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-01-31 16:17:35 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-01-31 16:17:40 (GMT)
commit1b46f2f12a368e6e4049b814d0b8499394fa442e (patch)
tree43826eca5eb37152e6cf26c8cf5ae1040e640842 /Source/cmGlobalXCodeGenerator.cxx
parentca0310b919cb389618d480cbdc0124609051866a (diff)
parent8a7f93d000f1676d6051027b0608ca7658c8f00e (diff)
downloadCMake-1b46f2f12a368e6e4049b814d0b8499394fa442e.zip
CMake-1b46f2f12a368e6e4049b814d0b8499394fa442e.tar.gz
CMake-1b46f2f12a368e6e4049b814d0b8499394fa442e.tar.bz2
Merge topic 'xcode-object-dir'
8a7f93d000 Xcode: Fix object library builds with sanitizers enabled eff9c69740 Xcode: Place object library artifacts outside Objects-normal directory Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2885
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx28
1 files changed, 16 insertions, 12 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 9c0c18b..f1b32ee 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -485,6 +485,7 @@ std::string cmGlobalXCodeGenerator::PostBuildMakeTarget(
}
#define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
+#define OBJECT_LIBRARY_ARTIFACT_DIR std::string()
void cmGlobalXCodeGenerator::AddExtraTargets(
cmLocalGenerator* root, std::vector<cmLocalGenerator*>& gens)
@@ -509,6 +510,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
makeHelper.push_back(dir);
makeHelper.push_back("-f");
makeHelper.push_back(this->CurrentXCodeHackMakefile);
+ makeHelper.push_back("OBJDIR=$(OBJDIR)");
makeHelper.push_back(""); // placeholder, see below
// Add ZERO_CHECK
@@ -1664,6 +1666,7 @@ void cmGlobalXCodeGenerator::AddCommandsToBuildPhase(
makecmd += cdir;
makecmd += " -f ";
makecmd += this->ConvertToRelativeForMake((makefile + "$CONFIGURATION"));
+ makecmd += " OBJDIR=$(basename \"$OBJECT_FILE_DIR_normal\")";
makecmd += " all";
buildphase->AddAttribute("shellScript", this->CreateString(makecmd));
buildphase->AddAttribute("showEnvVarsInLog", this->CreateString("0"));
@@ -1971,8 +1974,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
pnbase = gtgt->GetName();
pnsuffix = ".a";
- std::string pncdir =
- this->GetObjectsNormalDirectory(this->CurrentProject, configName, gtgt);
+ std::string pncdir = this->GetObjectsDirectory(
+ this->CurrentProject, configName, gtgt, OBJECT_LIBRARY_ARTIFACT_DIR);
buildSettings->AddAttribute("CONFIGURATION_BUILD_DIR",
this->CreateString(pncdir));
}
@@ -3202,9 +3205,9 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
return true;
}
-std::string cmGlobalXCodeGenerator::GetObjectsNormalDirectory(
+std::string cmGlobalXCodeGenerator::GetObjectsDirectory(
const std::string& projName, const std::string& configName,
- const cmGeneratorTarget* t) const
+ const cmGeneratorTarget* t, const std::string& variant) const
{
std::string dir = t->GetLocalGenerator()->GetCurrentBinaryDirectory();
dir += "/";
@@ -3213,8 +3216,8 @@ std::string cmGlobalXCodeGenerator::GetObjectsNormalDirectory(
dir += configName;
dir += "/";
dir += t->GetName();
- dir += ".build/Objects-normal/";
-
+ dir += ".build/";
+ dir += variant;
return dir;
}
@@ -3341,8 +3344,9 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
for (auto objLib : objlibs) {
const std::string objLibName = objLib->GetName();
- std::string d = this->GetObjectsNormalDirectory(this->CurrentProject,
- configName, objLib);
+ std::string d =
+ this->GetObjectsDirectory(this->CurrentProject, configName, objLib,
+ OBJECT_LIBRARY_ARTIFACT_DIR);
d += "lib";
d += objLibName;
d += ".a";
@@ -3359,8 +3363,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
// if building for more than one architecture
// then remove those executables as well
if (this->Architectures.size() > 1) {
- std::string universal = this->GetObjectsNormalDirectory(
- this->CurrentProject, configName, gt);
+ std::string universal = this->GetObjectsDirectory(
+ this->CurrentProject, configName, gt, "$(OBJDIR)/");
for (const auto& architecture : this->Architectures) {
std::string universalFile = universal;
universalFile += architecture;
@@ -3764,8 +3768,8 @@ void cmGlobalXCodeGenerator::ComputeTargetObjectDirectory(
cmGeneratorTarget* gt) const
{
std::string configName = this->GetCMakeCFGIntDir();
- std::string dir =
- this->GetObjectsNormalDirectory("$(PROJECT_NAME)", configName, gt);
+ std::string dir = this->GetObjectsDirectory(
+ "$(PROJECT_NAME)", configName, gt, "$(OBJECT_FILE_DIR_normal:base)/");
dir += this->ObjectDirArch;
dir += "/";
gt->ObjectDirectory = dir;