[cmake-commits] king committed cmLocalGenerator.cxx 1.208 1.209

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Apr 17 16:11:02 EDT 2007


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

Modified Files:
	cmLocalGenerator.cxx 
Log Message:
ENH: Added use of platform variable CMAKE_SHARED_MODULE_LOADER_<lang>_FLAG to add a special flag when linking a plugin to an executable that loads it.


Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.208
retrieving revision 1.209
diff -u -d -r1.208 -r1.209
--- cmLocalGenerator.cxx	10 Apr 2007 15:22:15 -0000	1.208
+++ cmLocalGenerator.cxx	17 Apr 2007 20:11:00 -0000	1.209
@@ -1585,7 +1585,7 @@
   for(std::vector<cmStdString>::iterator lib = libNames.begin();
       lib != libNames.end(); ++lib)
     {
-    linkLibs += *lib;
+    linkLibs += this->Convert(lib->c_str(), NONE, SHELL, false);
     linkLibs += " ";
     }
 
@@ -1639,10 +1639,33 @@
     linkType = cmTarget::DEBUG;
     }
 
+  // Get the language used for linking.
+  const char* linkLanguage =
+    target.GetLinkerLanguage(this->GetGlobalGenerator());
+  if(!linkLanguage)
+    {
+    cmSystemTools::
+      Error("CMake can not determine linker language for target:",
+            target.GetName());
+    return;
+    }
+
   // Check whether we should use an import library for linking a target.
   bool implib =
     this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")?true:false;
 
+  // On platforms without import libraries there may be a special flag
+  // to use when creating a plugin (module) that obtains symbols from
+  // the program that will load it.
+  const char* loader_flag = 0;
+  if(!implib && target.GetType() == cmTarget::MODULE_LIBRARY)
+    {
+    std::string loader_flag_var = "CMAKE_SHARED_MODULE_LOADER_";
+    loader_flag_var += linkLanguage;
+    loader_flag_var += "_FLAG";
+    loader_flag = this->Makefile->GetDefinition(loader_flag_var.c_str());
+    }
+
   // Get the list of libraries against which this target wants to link.
   std::vector<std::string> linkLibraries;
   const cmTarget::LinkLibraryVectorType& inLibs = target.GetLinkLibraries();
@@ -1677,10 +1700,10 @@
       bool impexe = (tgt &&
                      tgt->GetType() == cmTarget::EXECUTABLE &&
                      tgt->GetPropertyAsBool("ENABLE_EXPORTS"));
-      if(impexe && !implib)
+      if(impexe && !implib && !loader_flag)
         {
         // Skip linking to executables on platforms with no import
-        // libraries.
+        // libraries or loader flags.
         continue;
         }
       else if(tgt && (tgt->GetType() == cmTarget::STATIC_LIBRARY ||
@@ -1692,7 +1715,15 @@
         // 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, implib);
+        std::string linkItem;
+        if(impexe && loader_flag)
+          {
+          // This link item is an executable that may provide symbols
+          // used by this target.  A special flag is needed on this
+          // platform.  Add it now.
+          linkItem += loader_flag;
+          }
+        linkItem += tgt->GetDirectory(0, implib);
         linkItem += "/";
         linkItem += tgt->GetFullName(config, implib);
         linkLibraries.push_back(linkItem);
@@ -1735,17 +1766,6 @@
     }
   if(target_type_str)
     {
-    // Get the language used for linking.
-    const char* linkLanguage =
-      target.GetLinkerLanguage(this->GetGlobalGenerator());
-
-    if(!linkLanguage)
-      {
-      cmSystemTools::
-        Error("CMake can not determine linker language for target:",
-              target.GetName());
-      return;
-      }
     std::string static_link_type_flag_var = "CMAKE_";
     static_link_type_flag_var += target_type_str;
     static_link_type_flag_var += "_LINK_STATIC_";



More information about the Cmake-commits mailing list