[cmake-commits] king committed cmInstallTargetGenerator.cxx 1.25 1.26 cmLocalGenerator.cxx 1.197 1.198 cmLocalVisualStudio7Generator.cxx 1.177 1.178 cmMakefileLibraryTargetGenerator.cxx 1.34 1.35 cmTarget.cxx 1.127 1.128 cmTarget.h 1.75 1.76

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Mar 9 09:30:18 EST 2007


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

Modified Files:
	cmInstallTargetGenerator.cxx cmLocalGenerator.cxx 
	cmLocalVisualStudio7Generator.cxx 
	cmMakefileLibraryTargetGenerator.cxx cmTarget.cxx cmTarget.h 
Log Message:
ENH: Added implib option to cmTarget::GetDirectory to support a separate directory containing the import library.  This is an incremental step for bug#4210.


Index: cmLocalVisualStudio7Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.cxx,v
retrieving revision 1.177
retrieving revision 1.178
diff -u -d -r1.177 -r1.178
--- cmLocalVisualStudio7Generator.cxx	8 Mar 2007 20:33:18 -0000	1.177
+++ cmLocalVisualStudio7Generator.cxx	9 Mar 2007 14:30:16 -0000	1.178
@@ -605,7 +605,7 @@
       target.GetType() == cmTarget::MODULE_LIBRARY))
     {
     fout <<  "\t\t\t\tProgramDataBaseFileName=\""
-         << target.GetDirectory() << "/$(OutDir)/"
+         << target.GetDirectory(configName) << "/"
          << target.GetPDBName(configName) << "\"\n";
     }
   fout << "/>\n";  // end of <Tool Name=VCCLCompilerTool
@@ -728,8 +728,8 @@
     case cmTarget::STATIC_LIBRARY:
     {
     std::string targetNameFull = target.GetFullName(configName);
-    std::string libpath = target.GetDirectory();
-    libpath += "/$(OutDir)/";
+    std::string libpath = target.GetDirectory(configName);
+    libpath += "/";
     libpath += targetNameFull;
     fout << "\t\t\t<Tool\n"
          << "\t\t\t\tName=\"VCLibrarianTool\"\n";
@@ -795,9 +795,7 @@
          << " ";
     this->OutputLibraries(fout, linkLibs);
     fout << "\"\n";
-    temp = target.GetDirectory();
-    temp += "/";
-    temp += configName;
+    temp = target.GetDirectory(configName);
     temp += "/";
     temp += targetNameFull;
     fout << "\t\t\t\tOutputFile=\""
@@ -808,8 +806,8 @@
     this->OutputLibraryDirectories(fout, linkDirs);
     fout << "\"\n";
     this->OutputModuleDefinitionFile(fout, target);
-    temp = target.GetDirectory();
-    temp += "/$(OutDir)/";
+    temp = target.GetDirectory(configName);
+    temp += "/";
     temp += targetNamePDB;
     fout << "\t\t\t\tProgramDataBaseFile=\"" <<
       this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"\n";
@@ -826,9 +824,7 @@
       {
       fout << "\t\t\t\tStackReserveSize=\"" << stackVal  << "\"\n";
       }
-    temp = target.GetDirectory();
-    temp += "/";
-    temp += configName;
+    temp = target.GetDirectory(configName, true);
     temp += "/";
     temp += targetNameImport;
     fout << "\t\t\t\tImportLibrary=\""
@@ -875,9 +871,7 @@
          << " ";
     this->OutputLibraries(fout, linkLibs);
     fout << "\"\n";
-    temp = target.GetDirectory();
-    temp += "/";
-    temp += configName;
+    temp = target.GetDirectory(configName);
     temp += "/";
     temp += targetNameFull;
     fout << "\t\t\t\tOutputFile=\"" 
@@ -888,7 +882,7 @@
     this->OutputLibraryDirectories(fout, linkDirs);
     fout << "\"\n";
     fout << "\t\t\t\tProgramDataBaseFile=\""
-         << target.GetDirectory() << "\\$(OutDir)\\" << targetNamePDB
+         << target.GetDirectory(configName) << "/" << targetNamePDB
          << "\"\n";
     if(strcmp(configName, "Debug") == 0
        || strcmp(configName, "RelWithDebInfo") == 0)

Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -d -r1.197 -r1.198
--- cmLocalGenerator.cxx	8 Mar 2007 15:31:03 -0000	1.197
+++ cmLocalGenerator.cxx	9 Mar 2007 14:30:16 -0000	1.198
@@ -1619,6 +1619,10 @@
     linkType = cmTarget::DEBUG;
     }
 
+  // Check whether we should use an import library for linking a target.
+  bool implib =
+    this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")?true:false;
+
   // Get the list of libraries against which this target wants to link.
   std::vector<std::string> linkLibraries;
   const cmTarget::LinkLibraryVectorType& inLibs = target.GetLinkLibraries();
@@ -1658,9 +1662,9 @@
         // Pass the full path to the target file but purposely leave
         // off the per-configuration subdirectory.  The link directory
         // ordering knows how to deal with this.
-        std::string linkItem = tgt->GetDirectory(0);
+        std::string linkItem = tgt->GetDirectory(0, implib);
         linkItem += "/";
-        linkItem += tgt->GetFullName(config);
+        linkItem += tgt->GetFullName(config, implib);
         linkLibraries.push_back(linkItem);
         // For full path, use the true location.
         if(fullPathLibs)

Index: cmMakefileLibraryTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileLibraryTargetGenerator.cxx,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- cmMakefileLibraryTargetGenerator.cxx	8 Mar 2007 20:33:19 -0000	1.34
+++ cmMakefileLibraryTargetGenerator.cxx	9 Mar 2007 14:30:16 -0000	1.35
@@ -246,6 +246,7 @@
 
   // Construct the full path version of the names.
   std::string outpath;
+  std::string outpathImp;
   if(relink)
     {
     outpath = this->Makefile->GetStartOutputDirectory();
@@ -253,17 +254,20 @@
     outpath += "/CMakeRelink.dir";
     cmSystemTools::MakeDirectory(outpath.c_str());
     outpath += "/";
+    outpathImp = outpath;
     }
   else
     {
     outpath = this->Target->GetDirectory();
     outpath += "/";
+    outpathImp = this->Target->GetDirectory(0, true);
+    outpathImp += "/";
     }
   std::string targetFullPath = outpath + targetName;
   std::string targetFullPathPDB = outpath + targetNamePDB;
   std::string targetFullPathSO = outpath + targetNameSO;
   std::string targetFullPathReal = outpath + targetNameReal;
-  std::string targetFullPathImport = outpath + targetNameImport;
+  std::string targetFullPathImport = outpathImp + targetNameImport;
 
   // Construct the output path version of the names for use in command
   // arguments.

Index: cmTarget.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.h,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- cmTarget.h	8 Mar 2007 20:33:19 -0000	1.75
+++ cmTarget.h	9 Mar 2007 14:30:16 -0000	1.76
@@ -174,7 +174,7 @@
       configuration name is given then the generator will add its
       subdirectory for that configuration.  Otherwise just the canonical
       output directory is given.  */
-  const char* GetDirectory(const char* config = 0);
+  const char* GetDirectory(const char* config = 0, bool implib = false);
 
   /** Get the location of the target in the build tree for the given
       configuration.  This location is suitable for use as the LOCATION
@@ -340,7 +340,7 @@
   void SetPropertyDefault(const char* property, const char* default_value);
 
   // Get the full path to the target output directory.
-  const char* GetOutputDir();
+  const char* GetOutputDir(bool implib);
 
 private:
   std::string Name;

Index: cmInstallTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.cxx,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- cmInstallTargetGenerator.cxx	1 Feb 2007 14:57:24 -0000	1.25
+++ cmInstallTargetGenerator.cxx	9 Mar 2007 14:30:16 -0000	1.26
@@ -54,7 +54,7 @@
     }
   else
     {
-    fromDir = this->Target->GetDirectory();
+    fromDir = this->Target->GetDirectory(0, this->ImportLibrary);
     fromDir += "/";
     }
 

Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -d -r1.127 -r1.128
--- cmTarget.cxx	8 Mar 2007 20:33:19 -0000	1.127
+++ cmTarget.cxx	9 Mar 2007 14:30:16 -0000	1.128
@@ -661,7 +661,7 @@
         // Add the directory only if it is not already present.  This
         // is an N^2 algorithm for adding the directories, but N
         // should not get very big.
-        const char* libpath = tgt->GetDirectory();
+        const char* libpath = tgt->GetDirectory(0, true);
         if(std::find(this->LinkDirectories.begin(), 
                      this->LinkDirectories.end(),
                      libpath) == this->LinkDirectories.end())
@@ -1091,11 +1091,11 @@
   this->Properties.SetProperty(prop, value, cmProperty::TARGET);
 }
 
-const char* cmTarget::GetDirectory(const char* config)
+const char* cmTarget::GetDirectory(const char* config, bool implib)
 {
   if(config)
     {
-    this->Directory = this->GetOutputDir();
+    this->Directory = this->GetOutputDir(implib);
     // Add the configuration's subdirectory.
     this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->
       AppendDirectoryForConfig("/", config, "", this->Directory);
@@ -1103,7 +1103,7 @@
     }
   else
     {
-    return this->GetOutputDir();
+    return this->GetOutputDir(implib);
     }
 }
 
@@ -1446,7 +1446,7 @@
 std::string cmTarget::GetFullPath(const char* config, bool implib)
 {
   // Start with the output directory for the target.
-  std::string fpath = this->GetDirectory(config);
+  std::string fpath = this->GetDirectory(config, implib);
   fpath += "/";
 
   // Add the full name of the target.
@@ -1935,8 +1935,17 @@
 }
 
 //----------------------------------------------------------------------------
-const char* cmTarget::GetOutputDir()
+const char* cmTarget::GetOutputDir(bool implib)
 {
+  // The implib option is only allowed for shared libraries.
+  if(this->GetType() != cmTarget::SHARED_LIBRARY)
+    {
+    implib = false;
+    }
+
+  // For now the import library is always in the same directory as the DLL.
+  static_cast<void>(implib);
+
   if(this->OutputDir.empty())
     {
     // Lookup the output path for this target type.



More information about the Cmake-commits mailing list