[cmake-commits] king committed cmComputeLinkInformation.h 1.12 1.13 cmTarget.cxx 1.190 1.191 cmTarget.h 1.104 1.105

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Feb 6 13:34:47 EST 2008


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv1681/Source

Modified Files:
	cmComputeLinkInformation.h cmTarget.cxx cmTarget.h 
Log Message:
ENH: When linking to versioned targets whose real file name is known pass the real name to the linker instead of the symlink name.


Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -d -r1.104 -r1.105
--- cmTarget.h	1 Feb 2008 18:08:12 -0000	1.104
+++ cmTarget.h	6 Feb 2008 18:34:44 -0000	1.105
@@ -260,7 +260,8 @@
 
   /** Get the full path to the target according to the settings in its
       makefile and the configuration type.  */
-  std::string GetFullPath(const char* config=0, bool implib = false);
+  std::string GetFullPath(const char* config=0, bool implib = false,
+                          bool realname = false);
 
   /** Get the names of the library needed to generate a build rule
       that takes into account shared library version numbers.  This
@@ -437,7 +438,14 @@
   const char* NormalGetDirectory(const char* config, bool implib);
 
   std::string ImportedGetFullPath(const char* config, bool implib);
-  std::string NormalGetFullPath(const char* config, bool implib);
+  std::string NormalGetFullPath(const char* config, bool implib,
+                                bool realname);
+
+  /** Get the real name of the target.  Allowed only for non-imported
+      targets.  When a library or executable file is versioned this is
+      the full versioned name.  If the target is not versioned this is
+      the same as GetFullName.  */
+  std::string NormalGetRealName(const char* config);
 
 private:
   std::string Name;

Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.190
retrieving revision 1.191
diff -u -d -r1.190 -r1.191
--- cmTarget.cxx	1 Feb 2008 13:56:00 -0000	1.190
+++ cmTarget.cxx	6 Feb 2008 18:34:44 -0000	1.191
@@ -2008,6 +2008,40 @@
 }
 
 //----------------------------------------------------------------------------
+std::string cmTarget::NormalGetRealName(const char* config)
+{
+  // This should not be called for imported targets.
+  // TODO: Split cmTarget into a class hierarchy to get compile-time
+  // enforcement of the limited imported target API.
+  if(this->IsImported())
+    {
+    abort();
+    }
+
+  if(this->GetType() == cmTarget::EXECUTABLE)
+    {
+    // Compute the real name that will be built.
+    std::string name;
+    std::string realName;
+    std::string impName;
+    std::string pdbName;
+    this->GetExecutableNames(name, realName, impName, pdbName, config);
+    return realName;
+    }
+  else
+    {
+    // Compute the real name that will be built.
+    std::string name;
+    std::string soName;
+    std::string realName;
+    std::string impName;
+    std::string pdbName;
+    this->GetLibraryNames(name, soName, realName, impName, pdbName, config);
+    return realName;
+    }
+}
+
+//----------------------------------------------------------------------------
 std::string cmTarget::GetFullName(const char* config, bool implib)
 {
   if(this->IsImported())
@@ -2037,7 +2071,8 @@
 }
 
 //----------------------------------------------------------------------------
-std::string cmTarget::GetFullPath(const char* config, bool implib)
+std::string cmTarget::GetFullPath(const char* config, bool implib,
+                                  bool realname)
 {
   if(this->IsImported())
     {
@@ -2045,19 +2080,27 @@
     }
   else
     {
-    return this->NormalGetFullPath(config, implib);
+    return this->NormalGetFullPath(config, implib, realname);
     }
 }
 
 //----------------------------------------------------------------------------
-std::string cmTarget::NormalGetFullPath(const char* config, bool implib)
+std::string cmTarget::NormalGetFullPath(const char* config, bool implib,
+                                        bool realname)
 {
   // Start with the output directory for the target.
   std::string fpath = this->GetDirectory(config, implib);
   fpath += "/";
 
   // Add the full name of the target.
-  fpath += this->GetFullName(config, implib);
+  if(realname)
+    {
+    fpath += this->NormalGetRealName(config);
+    }
+  else
+    {
+    fpath += this->GetFullName(config, implib);
+    }
   return fpath;
 }
 

Index: cmComputeLinkInformation.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkInformation.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cmComputeLinkInformation.h	4 Feb 2008 20:22:10 -0000	1.12
+++ cmComputeLinkInformation.h	6 Feb 2008 18:34:44 -0000	1.13
@@ -162,8 +162,7 @@
   // Runtime path computation.
   cmOrderRuntimeDirectories* OrderRuntimeSearchPath;
   void AddLibraryRuntimeInfo(std::string const& fullPath, cmTarget* target);
-  void AddLibraryRuntimeInfo(std::string const& fullPath,
-                             const char* soname = 0);
+  void AddLibraryRuntimeInfo(std::string const& fullPath);
 
   // Dependent library path computation.
   cmOrderRuntimeDirectories* OrderDependentRPath;



More information about the Cmake-commits mailing list