summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-04-11 18:12:52 (GMT)
committerBrad King <brad.king@kitware.com>2017-04-18 13:03:33 (GMT)
commitd596c5504e8ee9e1cc51ddbf7a29815dd07fc05f (patch)
treeabfd2219152976d4e70747e4b5c0f089d90cdc97
parent930042f2d95e83047231457f4d9134c74b8744fc (diff)
downloadCMake-d596c5504e8ee9e1cc51ddbf7a29815dd07fc05f.zip
CMake-d596c5504e8ee9e1cc51ddbf7a29815dd07fc05f.tar.gz
CMake-d596c5504e8ee9e1cc51ddbf7a29815dd07fc05f.tar.bz2
cmGeneratorTarget: Add method to get the object file directory
Add a `GetObjectDirectory` method to get the target's object file directory for a specific configuration.
-rw-r--r--Source/cmGeneratorTarget.cxx13
-rw-r--r--Source/cmGeneratorTarget.h4
2 files changed, 17 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 4ce1eca..005323f 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3254,6 +3254,19 @@ std::string cmGeneratorTarget::GetPDBName(const std::string& config) const
return prefix + base + ".pdb";
}
+std::string cmGeneratorTarget::GetObjectDirectory(
+ std::string const& config) const
+{
+ std::string obj_dir =
+ this->GlobalGenerator->ExpandCFGIntDir(this->ObjectDirectory, config);
+#if defined(__APPLE__)
+ // find and replace $(PROJECT_NAME) xcode placeholder
+ const std::string projectName = this->LocalGenerator->GetProjectName();
+ cmSystemTools::ReplaceString(obj_dir, "$(PROJECT_NAME)", projectName);
+#endif
+ return obj_dir;
+}
+
void cmGeneratorTarget::GetTargetObjectNames(
std::string const& config, std::vector<std::string>& objects) const
{
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index bad67d0..5b903de 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -369,6 +369,10 @@ public:
time config name placeholder if needed for the generator. */
std::string ObjectDirectory;
+ /** Full path with trailing slash to the top-level directory
+ holding object files for the given configuration. */
+ std::string GetObjectDirectory(std::string const& config) const;
+
void GetAppleArchs(const std::string& config,
std::vector<std::string>& archVec) const;