On Fri, Jan 06, 2012 at 02:08:24PM -0500, Clifford Yapp wrote:
> Peter,
> 
> FYI, I'm seeing a problem with the BRL-CAD build on the Mac with CMake
> + ninja using the latest git versions - when I try to run tclsh, I get
> a problem with it trying to link
> TARGET_INSTALLNAME_DIRlibtcl.8.5.dylib instead of the local
> libtcl.8.5.dylib in the build directory.  This doesn't seem to happen
> on Linux.

Hi Clifford,

The attached patch should add support for TARGET_INSTALLNAME_DIR.
Please let me know if it works -- it's untested, as I don't have easy
access to a Mac.

> Also, a question - is it in the plans longer term to add build.ninja
> files in subdirectories, so I can cd into a subdirectory and build
> just what's required for that directory (i.e. like make)?  Or is ninja
> a "toplevel-only" setup?

Ninja doesn't work that way.  You can of course list specific targets
to build on the command line.

That said, a way of saying "build every target in this subdirectory"
(for example, by specifying that subdirectory as a target on the
command line) would be a nice feature to have.

Thanks,
-- 
Peter
>From 185519576e8d59318e856a757695920372fea0a0 Mon Sep 17 00:00:00 2001
From: Peter Collingbourne <[email protected]>
Date: Mon, 9 Jan 2012 22:32:18 +0000
Subject: [PATCH] Add support for TARGET_INSTALLNAME_DIR (untested)

---
 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

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to