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_LINK_LIBRARY_FLAG "library ")
SET(CMAKE_LINK_LIBRARY_FILE_FLAG "library")
IF(CMAKE_VERBOSE_MAKEFILE)
SET(CMAKE_WCL_QUIET)

View File

@ -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));
}

View File

@ -74,6 +74,7 @@ private:
bool UseImportLibrary;
const char* LoaderFlag;
std::string LibLinkFlag;
std::string LibLinkFileFlag;
std::string LibLinkSuffix;
// 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. "
"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!).",

View File

@ -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(' ');