summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-05-17 14:53:18 (GMT)
committerBrad King <brad.king@kitware.com>2007-05-17 14:53:18 (GMT)
commitc25d2bfdd2c81076bf637ae1b2aee711d9e6424d (patch)
treed8832b6899273a77800958ab852cbd5d2631c73c /Source
parentcc507411d3641297ed9fff7789cd4121dbe849b3 (diff)
downloadCMake-c25d2bfdd2c81076bf637ae1b2aee711d9e6424d.zip
CMake-c25d2bfdd2c81076bf637ae1b2aee711d9e6424d.tar.gz
CMake-c25d2bfdd2c81076bf637ae1b2aee711d9e6424d.tar.bz2
ENH: Added testing for custom command line arguments containing all special characters on the US keyboard. Fixed curly brace arguments on borland and % arguments in mingw32-make.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.cxx1
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.cxx1
-rw-r--r--Source/cmLocalGenerator.cxx5
-rw-r--r--Source/cmLocalGenerator.h1
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx22
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h13
6 files changed, 43 insertions, 0 deletions
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index 1f44c73..959cbe8 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -51,6 +51,7 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator()
lg->SetGlobalGenerator(this);
lg->SetUnixCD(false);
lg->SetMakeCommandEscapeTargetTwice(true);
+ lg->SetBorlandMakeCurlyHack(true);
return lg;
}
diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx
index 30cb948..89a01d8 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.cxx
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -61,6 +61,7 @@ cmLocalGenerator *cmGlobalMinGWMakefileGenerator::CreateLocalGenerator()
lg->SetIgnoreLibPrefix(true);
lg->SetPassMakeflags(false);
lg->SetUnixCD(true);
+ lg->SetMinGWMake(true);
// mingw32-make has trouble running code like
//
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 90fcb7b..c7c727b 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -47,6 +47,7 @@ cmLocalGenerator::cmLocalGenerator()
this->WindowsShell = false;
this->WindowsVSIDE = false;
this->WatcomWMake = false;
+ this->MinGWMake = false;
this->MSYSShell = false;
this->IgnoreLibPrefix = false;
this->UseRelativePaths = false;
@@ -2772,6 +2773,10 @@ std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars,
{
flags |= cmsysSystem_Shell_Flag_WatcomWMake;
}
+ if(this->MinGWMake)
+ {
+ flags |= cmsysSystem_Shell_Flag_MinGWMake;
+ }
// Compute the buffer size needed.
int size = (this->WindowsShell ?
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 38b4c0b..f767a69 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -304,6 +304,7 @@ protected:
bool WindowsShell;
bool WindowsVSIDE;
bool WatcomWMake;
+ bool MinGWMake;
bool ForceUnixPath;
bool MSYSShell;
bool UseRelativePaths;
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 3d89366..425997b 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -55,6 +55,7 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3()
this->NativeEchoWindows = true;
this->MakeCommandEscapeTargetTwice = false;
this->IsMakefileGenerator = true;
+ this->BorlandMakeCurlyHack = false;
}
//----------------------------------------------------------------------------
@@ -939,6 +940,27 @@ cmLocalUnixMakefileGenerator3
escapeAllowMakeVars);
}
}
+ if(this->BorlandMakeCurlyHack)
+ {
+ // Borland Make has a very strange bug. If the first curly
+ // brace anywhere in the command string is a left curly, it
+ // must be written {{} instead of just {. Otherwise some
+ // curly braces are removed. The hack can be skipped if the
+ // first curly brace is the last character.
+ std::string::size_type lcurly = cmd.find("{");
+ if(lcurly != cmd.npos && lcurly < (cmd.size()-1))
+ {
+ std::string::size_type rcurly = cmd.find("}");
+ if(rcurly == cmd.npos || rcurly > lcurly)
+ {
+ // The first curly is a left curly. Use the hack.
+ std::string hack_cmd = cmd.substr(0, lcurly);
+ hack_cmd += "{{}";
+ hack_cmd += cmd.substr(lcurly+1);
+ cmd = hack_cmd;
+ }
+ }
+ }
commands1.push_back(cmd);
}
}
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 07d1f95..4eeadd6 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -98,6 +98,11 @@ public:
void SetWatcomWMake(bool v) {this->WatcomWMake = v;}
/**
+ * Set to true if the make tool being used is MinGW Make.
+ */
+ void SetMinGWMake(bool v) {this->MinGWMake = v;}
+
+ /**
* Set to true if the shell being used is the MSYS shell.
* This controls if statements in the makefile and the SHELL variable.
* The default is false.
@@ -165,6 +170,13 @@ public:
void SetMakeCommandEscapeTargetTwice(bool b)
{ this->MakeCommandEscapeTargetTwice = b; }
+ /**
+ * Set whether the Borland curly brace command line hack should be
+ * applied.
+ */
+ void SetBorlandMakeCurlyHack(bool b)
+ { this->BorlandMakeCurlyHack = b; }
+
// used in writing out Cmake files such as WriteDirectoryInformation
static void WriteCMakeArgument(std::ostream& os, const char* s);
@@ -338,6 +350,7 @@ private:
bool PassMakeflags;
bool SilentNoColon;
bool MakeCommandEscapeTargetTwice;
+ bool BorlandMakeCurlyHack;
//==========================================================================
std::string HomeRelativeOutputPath;