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.
This commit is contained in:
Brad King 2008-01-23 13:30:55 -05:00
parent 865c2bc6d6
commit 09af624dee
5 changed files with 25 additions and 4 deletions

View File

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

View File

@ -187,6 +187,8 @@ cmComputeLinkInformation
// Get options needed to link libraries. // Get options needed to link libraries.
this->LibLinkFlag = this->LibLinkFlag =
this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FLAG"); this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FLAG");
this->LibLinkFileFlag =
this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_FILE_FLAG");
this->LibLinkSuffix = this->LibLinkSuffix =
this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_SUFFIX"); this->Makefile->GetSafeDefinition("CMAKE_LINK_LIBRARY_SUFFIX");
@ -622,6 +624,12 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item,
this->SetCurrentLinkType(LinkShared); 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. // Now add the full path to the library.
this->Items.push_back(Item(item, true)); 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. // Now add the full path to the library.
this->Items.push_back(Item(item, true)); this->Items.push_back(Item(item, true));
} }

View File

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

View File

@ -777,6 +777,12 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"The flag used to specify a library to link to an executable. " "The flag used to specify a library to link to an executable. "
"On most compilers this is \"-l\".",false, "On most compilers this is \"-l\".",false,
"Variables that Control the Build"); "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 cm->DefineProperty
("CMAKE_USE_RELATIVE_PATHS", cmProperty::VARIABLE, ("CMAKE_USE_RELATIVE_PATHS", cmProperty::VARIABLE,
"Use relative paths (May not work!).", "Use relative paths (May not work!).",

View File

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