Browse Source

BUG: Fix generation of Watcom link lines.

  - Work-around bug in Watcom command line parsing for spaces in paths.
  - Add 'library' option before libraries specified by file path.
Brad King 18 years ago
parent
commit
09af624dee

+ 1 - 0
Modules/Platform/Windows-wcl386.cmake

@@ -1,5 +1,6 @@
 SET(CMAKE_LIBRARY_PATH_FLAG "libpath ")
 SET(CMAKE_LINK_LIBRARY_FLAG "library ")
+SET(CMAKE_LINK_LIBRARY_FILE_FLAG "library")
 
 IF(CMAKE_VERBOSE_MAKEFILE)
   SET(CMAKE_WCL_QUIET)

+ 14 - 0
Source/cmComputeLinkInformation.cxx

@@ -187,6 +187,8 @@ cmComputeLinkInformation
   // Get options needed to link libraries.
   this->LibLinkFlag =
     this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FLAG");
+  this->LibLinkFileFlag =
+    this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FILE_FLAG");
   this->LibLinkSuffix =
     this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_SUFFIX");
 
@@ -622,6 +624,12 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item,
     this->SetCurrentLinkType(LinkShared);
     }
 
+  // If this platform wants a flag before the full path, add it.
+  if(!this->LibLinkFileFlag.empty())
+    {
+    this->Items.push_back(Item(this->LibLinkFileFlag, false));
+    }
+
   // Now add the full path to the library.
   this->Items.push_back(Item(item, true));
 }
@@ -650,6 +658,12 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item)
       }
     }
 
+  // If this platform wants a flag before the full path, add it.
+  if(!this->LibLinkFileFlag.empty())
+    {
+    this->Items.push_back(Item(this->LibLinkFileFlag, false));
+    }
+
   // Now add the full path to the library.
   this->Items.push_back(Item(item, true));
 }

+ 1 - 0
Source/cmComputeLinkInformation.h

@@ -74,6 +74,7 @@ private:
   bool UseImportLibrary;
   const char* LoaderFlag;
   std::string LibLinkFlag;
+  std::string LibLinkFileFlag;
   std::string LibLinkSuffix;
 
   // Link type adjustment.

+ 6 - 0
Source/cmDocumentVariables.cxx

@@ -777,6 +777,12 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
      "The flag used to specify a library to link to an executable.  "
      "On most compilers this is \"-l\".",false,
      "Variables that Control the Build");
+  cm->DefineProperty
+    ("CMAKE_LINK_LIBRARY_FILE_FLAG", cmProperty::VARIABLE,
+     "Flag used to link a library specified by a path to its file.",
+     "The flag used before a library file path is given to the linker.  "
+     "This is needed only on very few platforms.", false,
+     "Variables that Control the Build");
   cm->DefineProperty
     ("CMAKE_USE_RELATIVE_PATHS", cmProperty::VARIABLE,
      "Use relative paths (May not work!).",

+ 3 - 4
Source/cmLocalGenerator.cxx

@@ -1454,10 +1454,9 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
 std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib)
 {
 #if defined(_WIN32) && !defined(__CYGWIN__)
-  // Work-ardound MSVC 6 command line bug.  This block is only needed
-  // on windows when we are really using the MSVC 6.0 compiler command
-  // line.
-  if(this->Makefile->IsOn("MSVC60"))
+  // Work-ardound command line parsing limitations in MSVC 6.0 and
+  // Watcom.
+  if(this->Makefile->IsOn("MSVC60") || this->Makefile->IsOn("WATCOM"))
     {
     // Search for the last space.
     std::string::size_type pos = lib.rfind(' ');