Sorry, previous patch has bug.
I enclosed corrected version of patch.

Jiri
>From 8619dc83bda0232bfca970f66d0ff87c82dd7cd2 Mon Sep 17 00:00:00 2001
From: Jiri Malak <[email protected]>
Date: Tue, 25 Mar 2014 07:17:45 +0100
Subject: [PATCH] remove CMAKE_NO_QUOTED_OBJECTS variable

remove CMAKE_NO_QUOTED_OBJECTS from make file generator because it fix
problem with Watcom linker, not with make tools difference
replace it by proper quote handling by
${linker_rule}_USE_SINGLE_QUOTE variables
---
 Modules/Platform/Windows-wcl386.cmake          |  5 +++
 Source/cmGlobalWatcomWMakeGenerator.cxx        |  1 -
 Source/cmLocalUnixMakefileGenerator3.cxx       | 59 +++++++++++++-------------
 Source/cmLocalUnixMakefileGenerator3.h         |  2 +-
 Source/cmMakefileExecutableTargetGenerator.cxx |  3 +-
 Source/cmMakefileLibraryTargetGenerator.cxx    |  3 +-
 Source/cmMakefileTargetGenerator.cxx           | 37 +++++-----------
 Source/cmMakefileTargetGenerator.h             |  6 ++-
 8 files changed, 53 insertions(+), 63 deletions(-)

diff --git a/Modules/Platform/Windows-wcl386.cmake 
b/Modules/Platform/Windows-wcl386.cmake
index 6b1cfd1..359097f 100644
--- a/Modules/Platform/Windows-wcl386.cmake
+++ b/Modules/Platform/Windows-wcl386.cmake
@@ -39,6 +39,11 @@ set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot 
-dNDEBUG")
 set (CMAKE_C_STANDARD_LIBRARIES_INIT "library clbrdll.lib library plbrdll.lib  
library kernel32.lib library user32.lib library gdi32.lib library winspool.lib 
library comdlg32.lib library advapi32.lib library shell32.lib library ole32.lib 
library oleaut32.lib library uuid.lib library odbc32.lib library odbccp32.lib")
 set (CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
 
+foreach(type CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE)
+  set(CMAKE_C_${type}_USE_SINGLE_QUOTE 1)
+  set(CMAKE_CXX_${type}_USE_SINGLE_QUOTE 1)
+endforeach()
+
 set(CMAKE_C_CREATE_IMPORT_LIBRARY
   "wlib -c -q -n -b <TARGET_IMPLIB> +<TARGET_QUOTED>")
 set(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY})
diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx 
b/Source/cmGlobalWatcomWMakeGenerator.cxx
index 0ae1b34..e44ed79 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.cxx
+++ b/Source/cmGlobalWatcomWMakeGenerator.cxx
@@ -35,7 +35,6 @@ void cmGlobalWatcomWMakeGenerator
   mf->AddDefinition("CMAKE_MANGLE_OBJECT_FILE_NAMES", "1");
   mf->AddDefinition("CMAKE_MAKE_LINE_CONTINUE", "&");
   mf->AddDefinition("CMAKE_MAKE_SYMBOLIC_RULE", ".SYMBOLIC");
-  mf->AddDefinition("CMAKE_NO_QUOTED_OBJECTS", "1");
   mf->AddDefinition("CMAKE_GENERATOR_CC", "wcl386");
   mf->AddDefinition("CMAKE_GENERATOR_CXX", "wcl386");
   this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx 
b/Source/cmLocalUnixMakefileGenerator3.cxx
index cc872d5..0c804a7 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -2181,59 +2181,58 @@ cmLocalUnixMakefileGenerator3
 
 //----------------------------------------------------------------------------
 std::string
-cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p)
+cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p, const 
char* quote)
 {
 
   // Split the path into its components.
   std::vector<std::string> components;
   cmSystemTools::SplitPath(p, components);
+  // Open the quoted result.
+  std::string result = quote;
 
   // Return an empty path if there are no components.
-  if(components.empty())
+  if(!components.empty())
     {
-    return "\"\"";
-    }
-
-  // Choose a slash direction and fix root component.
-  const char* slash = "/";
+    // Choose a slash direction and fix root component.
+    const char* slash = "/";
 #if defined(_WIN32) && !defined(__CYGWIN__)
-   if(!cmSystemTools::GetForceUnixPaths())
-     {
-     slash = "\\";
-     for(std::string::iterator i = components[0].begin();
-       i != components[0].end(); ++i)
+     if(!cmSystemTools::GetForceUnixPaths())
        {
-       if(*i == '/')
+       slash = "\\";
+       for(std::string::iterator i = components[0].begin();
+         i != components[0].end(); ++i)
          {
-         *i = '\\';
+         if(*i == '/')
+           {
+           *i = '\\';
+           }
          }
        }
-     }
 #endif
 
-  // Begin the quoted result with the root component.
-  std::string result = "\"";
-  result += components[0];
+    // Begin the quoted result with the root component.
+    result += components[0];
 
-  // Now add the rest of the components separated by the proper slash
-  // direction for this platform.
-  bool first = true;
-  for(unsigned int i=1; i < components.size(); ++i)
-    {
-    // Only the last component can be empty to avoid double slashes.
-    if(components[i].length() > 0 || (i == (components.size()-1)))
+    // Now add the rest of the components separated by the proper slash
+    // direction for this platform.
+    bool first = true;
+    for(unsigned int i=1; i < components.size(); ++i)
       {
-      if(!first)
+      // Only the last component can be empty to avoid double slashes.
+      if(components[i].length() > 0 || (i == (components.size()-1)))
         {
-        result += slash;
+        if(!first)
+          {
+          result += slash;
+          }
+        result += components[i];
+        first = false;
         }
-      result += components[i];
-      first = false;
       }
     }
 
   // Close the quoted result.
-  result += "\"";
+  result += quote;
 
   return result;
 }
diff --git a/Source/cmLocalUnixMakefileGenerator3.h 
b/Source/cmLocalUnixMakefileGenerator3.h
index 14543fb..76aef55 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -186,7 +186,7 @@ public:
                        const char *targetDir,
                        cmLocalGenerator::RelativeRoot returnDir);
 
-  static std::string ConvertToQuotedOutputPath(const char* p);
+  static std::string ConvertToQuotedOutputPath(const char* p, const char* 
quote);
 
   std::string CreateMakeVariable(const std::string& sin,
                                  const std::string& s2in);
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx 
b/Source/cmMakefileExecutableTargetGenerator.cxx
index a61005b..928ab73 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -343,7 +343,8 @@ void 
cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
   // rule.
   std::string buildObjs;
   this->CreateObjectLists(useLinkScript, false,
-                          useResponseFileForObjects, buildObjs, depends);
+                          useResponseFileForObjects, buildObjs, depends,
+                          this->Makefile->IsOn(linkRuleVar + 
"_USE_SINGLE_QUOTE"));
 
   cmLocalGenerator::RuleVariables vars;
   vars.RuleLauncher = "RULE_LAUNCH_LINK";
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx 
b/Source/cmMakefileLibraryTargetGenerator.cxx
index 02469d1..2e22d1f 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -553,7 +553,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
   // rule.
   std::string buildObjs;
   this->CreateObjectLists(useLinkScript, useArchiveRules,
-                          useResponseFileForObjects, buildObjs, depends);
+                          useResponseFileForObjects, buildObjs, depends,
+                          this->Makefile->IsOn(linkRuleVar + 
"_USE_SINGLE_QUOTE"));
 
   cmLocalGenerator::RuleVariables vars;
   vars.TargetPDB = targetOutPathPDB.c_str();
diff --git a/Source/cmMakefileTargetGenerator.cxx 
b/Source/cmMakefileTargetGenerator.cxx
index 6759d05..803f5ed 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1349,10 +1349,12 @@ 
cmMakefileTargetGenerator::AppendProgress(std::vector<std::string>& commands)
 void
 cmMakefileTargetGenerator
 ::WriteObjectsVariable(std::string& variableName,
-                       std::string& variableNameExternal)
+                       std::string& variableNameExternal,
+                       bool useSingleQuote)
 {
   // Write a make variable assignment that lists all objects for the
   // target.
+  char const* quote = (useSingleQuote) ? "'" : "\"";
   variableName =
     this->LocalGenerator->CreateMakeVariable(this->Target->GetName(),
                                              "_OBJECTS");
@@ -1360,8 +1362,6 @@ cmMakefileTargetGenerator
     << "# Object files for target " << this->Target->GetName() << "\n"
     << variableName << " =";
   std::string object;
-  const char* objName =
-    this->Makefile->GetDefinition("CMAKE_NO_QUOTED_OBJECTS");
   const char* lineContinue =
     this->Makefile->GetDefinition("CMAKE_MAKE_LINE_CONTINUE");
   if(!lineContinue)
@@ -1372,17 +1372,8 @@ cmMakefileTargetGenerator
       i != this->Objects.end(); ++i)
     {
     *this->BuildFileStream << " " << lineContinue << "\n";
-    if(objName)
-      {
-      *this->BuildFileStream <<
-        this->Convert(*i, cmLocalGenerator::START_OUTPUT,
-                      cmLocalGenerator::MAKEFILE);
-      }
-    else
-      {
-      *this->BuildFileStream  <<
-        this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str());
-      }
+    *this->BuildFileStream  <<
+      this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str(), quote);
     }
   *this->BuildFileStream << "\n";
 
@@ -1404,17 +1395,8 @@ cmMakefileTargetGenerator
     *this->BuildFileStream
       << " " << lineContinue << "\n"
       << this->Makefile->GetSafeDefinition("CMAKE_OBJECT_NAME");
-    if(objName)
-      {
-      *this->BuildFileStream  <<
-        this->Convert(*i, cmLocalGenerator::START_OUTPUT,
-                      cmLocalGenerator::MAKEFILE);
-      }
-    else
-      {
-      *this->BuildFileStream  <<
-        this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str());
-      }
+    *this->BuildFileStream  <<
+      this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str(), quote);
     }
   *this->BuildFileStream << "\n" << "\n";
 }
@@ -1882,11 +1864,12 @@ void
 cmMakefileTargetGenerator
 ::CreateObjectLists(bool useLinkScript, bool useArchiveRules,
                     bool useResponseFile, std::string& buildObjs,
-                    std::vector<std::string>& makefile_depends)
+                    std::vector<std::string>& makefile_depends,
+                    bool useSingleQuote)
 {
   std::string variableName;
   std::string variableNameExternal;
-  this->WriteObjectsVariable(variableName, variableNameExternal);
+  this->WriteObjectsVariable(variableName, variableNameExternal, 
useSingleQuote);
   if(useResponseFile)
     {
     // MSVC response files cannot exceed 128K.
diff --git a/Source/cmMakefileTargetGenerator.h 
b/Source/cmMakefileTargetGenerator.h
index 7ff6da9..0e10b62 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -113,7 +113,8 @@ protected:
 
   // write out the variable that lists the objects for this target
   void WriteObjectsVariable(std::string& variableName,
-                            std::string& variableNameExternal);
+                            std::string& variableNameExternal,
+                            bool useSingleQuote);
   void WriteObjectsString(std::string& buildObjs);
   void WriteObjectsStrings(std::vector<std::string>& objStrings,
                            std::string::size_type limit = std::string::npos);
@@ -172,7 +173,8 @@ protected:
   /** Create lists of object files for linking and cleaning.  */
   void CreateObjectLists(bool useLinkScript, bool useArchiveRules,
                          bool useResponseFile, std::string& buildObjs,
-                         std::vector<std::string>& makefile_depends);
+                         std::vector<std::string>& makefile_depends,
+                         bool useSingleQuote);
 
   void AddIncludeFlags(std::string& flags, const std::string& lang);
 
-- 
1.8.1.msysgit.1
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to