[PATCH] Add support for TARGET_INSTALLNAME_DIR (untested)

Peter Collingbourne peter at pcc.me.uk
Mon Jan 9 17:32:18 EST 2012


---
 Source/cmNinjaNormalTargetGenerator.cxx |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 8a223b4..98cbe04 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -134,6 +134,7 @@ cmNinjaNormalTargetGenerator
     vars.ObjectDir = objdir.c_str();
     vars.Target = "$out";
     vars.TargetSOName = "$SONAME";
+    vars.TargetInstallNameDir = "$INSTALLNAME_DIR";
 
     // Setup the target version.
     std::string targetVersionMajor;
@@ -322,6 +323,18 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
                                                   this->GetConfigName());
   vars["SONAME"] = this->TargetNameSO;
 
+  if (this->GetTarget()->GetType() == cmTarget::SHARED_LIBRARY) {
+    std::string install_name_dir =
+      this->GetTarget()->GetInstallNameDirForBuildTree(this->GetConfigName());
+
+    if (!install_name_dir.empty()) {
+      vars["INSTALLNAME_DIR"] =
+        this->GetLocalGenerator()->Convert(install_name_dir.c_str(),
+            cmLocalGenerator::NONE,
+            cmLocalGenerator::SHELL, false);
+    }
+  }
+
   std::vector<cmCustomCommand> *cmdLists[3] = {
     &this->GetTarget()->GetPreBuildCommands(),
     &this->GetTarget()->GetPreLinkCommands(),
-- 
1.7.5.3


--ReaqsoxgOBHFXBhH--


More information about the CMake mailing list