On 03/22/2013 04:38 AM, Vittorio Giovara wrote:
> difference I see is that <TARGET> in the _LINK_EXECUTABLE
> or _CREATE_SHARED_LIBRARY gets reported as a relative path,
> while in _COMPILE_OBJECT you get the full path.

Oops, I had copied the TargetPDB path conversion which needs to
be full path for some toolchains IIRC.  There is no reason for
<TARGET> to be so.  Try this one instead.

Thanks,
-Brad
>From bf15c02c45778b2ced98f5df122bcc9c7ee6e1fb Mon Sep 17 00:00:00 2001
Message-Id: <bf15c02c45778b2ced98f5df122bcc9c7ee6e1fb.1363953198.git.brad.k...@kitware.com>
From: Brad King <[email protected]>
Date: Thu, 21 Mar 2013 14:31:57 -0400
Subject: [PATCH] Replace <TARGET> in CMAKE_<LANG>_COMPILE_OBJECT rule
 variables

In some languages the compiler may need to know the path of the final
target file for which an object is being compiled.  Honor the <TARGET>
placeholder for compilation rules to support such cases.

Note that this cannot work with OBJECT library targets because the final
target path is not known during compilation (there can even be more than
one final target).

Suggested-by: Vittorio Giovara <[email protected]>
---
 Source/cmMakefileTargetGenerator.cxx |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 3d02d6a..ff65eef 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -639,18 +639,25 @@ cmMakefileTargetGenerator
       (commands, buildEcho.c_str(), cmLocalUnixMakefileGenerator3::EchoBuild);
     }
 
+  std::string targetOutPathReal;
   std::string targetOutPathPDB;
   {
+  std::string targetFullPathReal;
   std::string targetFullPathPDB;
   if(this->Target->GetType() == cmTarget::EXECUTABLE ||
      this->Target->GetType() == cmTarget::STATIC_LIBRARY ||
      this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
      this->Target->GetType() == cmTarget::MODULE_LIBRARY)
     {
+    targetFullPathReal =
+      this->Target->GetFullPath(this->ConfigName, false, true);
     targetFullPathPDB = this->Target->GetPDBDirectory(this->ConfigName);
     targetFullPathPDB += "/";
     targetFullPathPDB += this->Target->GetPDBName(this->ConfigName);
     }
+  targetOutPathReal = this->Convert(targetFullPathReal.c_str(),
+                                    cmLocalGenerator::START_OUTPUT,
+                                    cmLocalGenerator::SHELL);
   targetOutPathPDB =
     this->Convert(targetFullPathPDB.c_str(),cmLocalGenerator::NONE,
                   cmLocalGenerator::SHELL);
@@ -659,6 +666,7 @@ cmMakefileTargetGenerator
   vars.RuleLauncher = "RULE_LAUNCH_COMPILE";
   vars.CMTarget = this->Target;
   vars.Language = lang;
+  vars.Target = targetOutPathReal.c_str();
   vars.TargetPDB = targetOutPathPDB.c_str();
   vars.Source = sourceFile.c_str();
   std::string shellObj =
-- 
1.7.10.4

--

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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to