summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2011-11-08 19:43:31 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2011-11-08 19:43:31 (GMT)
commit5a3a5ba0522df360a9d855958a06dce4b01413f1 (patch)
treeaac50202516bdbf36e245a2b80df8eb7b5df9453
parenta985a9e0f783cf2e8c84491145a52e482ef03ae0 (diff)
parent23381d83d8d8399eea372e3f2407beac39e55b98 (diff)
downloadCMake-5a3a5ba0522df360a9d855958a06dce4b01413f1.zip
CMake-5a3a5ba0522df360a9d855958a06dce4b01413f1.tar.gz
CMake-5a3a5ba0522df360a9d855958a06dce4b01413f1.tar.bz2
Merge topic 'watcom-cmake-shortpath-issue-12548'
23381d8 Watcom: Use shortpath to CMake if full path has parens (#12548)
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx42
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h1
2 files changed, 26 insertions, 17 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index da6a1c6..c8a06aa 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -608,6 +608,27 @@ cmLocalUnixMakefileGenerator3
}
//----------------------------------------------------------------------------
+std::string
+cmLocalUnixMakefileGenerator3
+::ConvertShellCommand(std::string const& cmd, RelativeRoot root)
+{
+ if(this->WatcomWMake &&
+ cmSystemTools::FileIsFullPath(cmd.c_str()) &&
+ cmd.find_first_of("( )") != cmd.npos)
+ {
+ // On Watcom WMake use the windows short path for the command
+ // name. This is needed to avoid funny quoting problems on
+ // lines with shell redirection operators.
+ std::string scmd;
+ if(cmSystemTools::GetShortPath(cmd.c_str(), scmd))
+ {
+ return this->Convert(scmd.c_str(), NONE, SHELL);
+ }
+ }
+ return this->Convert(cmd.c_str(), root, SHELL);
+}
+
+//----------------------------------------------------------------------------
void
cmLocalUnixMakefileGenerator3
::WriteMakeVariables(std::ostream& makefileStream)
@@ -646,13 +667,13 @@ cmLocalUnixMakefileGenerator3
makefileStream
<< "# The CMake executable.\n"
<< "CMAKE_COMMAND = "
- << this->Convert(cmakecommand.c_str(), FULL, SHELL).c_str()
+ << this->ConvertShellCommand(cmakecommand, FULL)
<< "\n"
<< "\n";
makefileStream
<< "# The command to remove a file.\n"
<< "RM = "
- << this->Convert(cmakecommand.c_str(),FULL,SHELL).c_str()
+ << this->ConvertShellCommand(cmakecommand, FULL)
<< " -E remove -f\n"
<< "\n";
@@ -662,7 +683,7 @@ cmLocalUnixMakefileGenerator3
makefileStream
<< "# The program to use to edit the cache.\n"
<< "CMAKE_EDIT_COMMAND = "
- << this->Convert(edit_cmd,FULL,SHELL) << "\n"
+ << this->ConvertShellCommand(edit_cmd, FULL) << "\n"
<< "\n";
}
@@ -1019,22 +1040,9 @@ cmLocalUnixMakefileGenerator3
// without the current directory being in the search path.
cmd = "./" + cmd;
}
- if(this->WatcomWMake &&
- cmSystemTools::FileIsFullPath(cmd.c_str()) &&
- cmd.find(" ") != cmd.npos)
- {
- // On Watcom WMake use the windows short path for the command
- // name. This is needed to avoid funny quoting problems on
- // lines with shell redirection operators.
- std::string scmd;
- if(cmSystemTools::GetShortPath(cmd.c_str(), scmd))
- {
- cmd = scmd;
- }
- }
std::string launcher =
this->MakeLauncher(cc, target, workingDir? NONE : START_OUTPUT);
- cmd = launcher + this->Convert(cmd.c_str(),NONE,SHELL);
+ cmd = launcher + this->ConvertShellCommand(cmd, NONE);
ccg.AppendArguments(c, cmd);
if(content)
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index fab98da..45ac21d 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -340,6 +340,7 @@ protected:
void CheckMultipleOutputs(bool verbose);
private:
+ std::string ConvertShellCommand(std::string const& cmd, RelativeRoot root);
std::string MakeLauncher(const cmCustomCommand& cc, cmTarget* target,
RelativeRoot relative);