From 09af624deefa6d88e6d13d6a13907e7caf965d25 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 23 Jan 2008 13:30:55 -0500 Subject: 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. --- Modules/Platform/Windows-wcl386.cmake | 1 + Source/cmComputeLinkInformation.cxx | 14 ++++++++++++++ Source/cmComputeLinkInformation.h | 1 + Source/cmDocumentVariables.cxx | 6 ++++++ Source/cmLocalGenerator.cxx | 7 +++---- 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake index a98bcaf..87a61d5 100644 --- a/Modules/Platform/Windows-wcl386.cmake +++ b/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) diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index d5df212..78ad4de 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/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)); } diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index e45ac9f..f082e09 100644 --- a/Source/cmComputeLinkInformation.h +++ b/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. diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index d744145..33b0a6e 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -778,6 +778,12 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "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!).", "If this is set to TRUE, then the CMake will use " diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 62245fe..f49e1bd 100644 --- a/Source/cmLocalGenerator.cxx +++ b/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(' '); -- cgit v0.12